Skip to content

Commit

Permalink
fix total_count for validators endpoint. Removed total_count from tra…
Browse files Browse the repository at this point in the history
…nsaction stream endpoint and cursor mixin for endpoints that aren't using it.
  • Loading branch information
PawelPawelec-RDX committed Oct 3, 2024
1 parent 9ae62d0 commit 967dfe3
Show file tree
Hide file tree
Showing 14 changed files with 162 additions and 538 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ Release built: _not released yet_
> - `/state/entity/page/non-fungibles/` (when using `non_fungible_include_nfids` opt-in)
> - `/state/entity/page/non-fungible-vaults/` (when using `non_fungible_include_nfids` opt-in)

### Bug fixes

- Added missing `total_count` property to `/state/validators/list` response.
### API Changes
- Restored previously removed `total_count` property to `/state/key-value-store/keys` endpoint.

Expand Down
41 changes: 20 additions & 21 deletions src/RadixDlt.NetworkGateway.GatewayApi/gateway-api-schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2317,16 +2317,14 @@ components:

TwoWayLinkedDappsCollection:
description: A collection of two-way linked (resolved & verified) dApps linked to the entity defining this collection.
allOf:
- $ref: "#/components/schemas/ResultSetCursorMixin"
- type: object
required:
- items
properties:
items:
type: array
items:
$ref: "#/components/schemas/TwoWayLinkedDappsCollectionItem"
type: object
required:
- items
properties:
items:
type: array
items:
$ref: "#/components/schemas/TwoWayLinkedDappsCollectionItem"
TwoWayLinkedDappsCollectionItem:
type: object
required:
Expand All @@ -2337,16 +2335,14 @@ components:

TwoWayLinkedEntitiesCollection:
description: A collection of two-way linked (resolved & verified) entities linked to the entity defining this collection.
allOf:
- $ref: "#/components/schemas/ResultSetCursorMixin"
- type: object
required:
- items
properties:
items:
type: array
items:
$ref: "#/components/schemas/TwoWayLinkedEntitiesCollectionItem"
type: object
required:
- items
properties:
items:
type: array
items:
$ref: "#/components/schemas/TwoWayLinkedEntitiesCollectionItem"
TwoWayLinkedEntitiesCollectionItem:
type: object
required:
Expand Down Expand Up @@ -4055,11 +4051,14 @@ components:
StreamTransactionsResponse:
allOf:
- $ref: "#/components/schemas/LedgerStateMixin"
- $ref: "#/components/schemas/ResultSetCursorMixin"
- type: object
required:
- items
properties:
next_cursor:
description: If specified, contains a cursor to query next page of the `items` collection.
type: string
nullable: true
items:
description: The page of user transactions.
type: array
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,9 @@ protected StreamTransactionsResponse() { }
/// Initializes a new instance of the <see cref="StreamTransactionsResponse" /> class.
/// </summary>
/// <param name="ledgerState">ledgerState (required).</param>
/// <param name="totalCount">Total number of items in underlying collection, fragment of which is available in &#x60;items&#x60; collection..</param>
/// <param name="nextCursor">If specified, contains a cursor to query next page of the &#x60;items&#x60; collection..</param>
/// <param name="items">The page of user transactions. (required).</param>
public StreamTransactionsResponse(LedgerState ledgerState = default(LedgerState), long? totalCount = default(long?), string nextCursor = default(string), List<CommittedTransactionInfo> items = default(List<CommittedTransactionInfo>))
public StreamTransactionsResponse(LedgerState ledgerState = default(LedgerState), string nextCursor = default(string), List<CommittedTransactionInfo> items = default(List<CommittedTransactionInfo>))
{
// to ensure "ledgerState" is required (not null)
if (ledgerState == null)
Expand All @@ -121,7 +120,6 @@ protected StreamTransactionsResponse() { }
throw new ArgumentNullException("items is a required property for StreamTransactionsResponse and cannot be null");
}
this.Items = items;
this.TotalCount = totalCount;
this.NextCursor = nextCursor;
}

Expand All @@ -131,13 +129,6 @@ protected StreamTransactionsResponse() { }
[DataMember(Name = "ledger_state", IsRequired = true, EmitDefaultValue = true)]
public LedgerState LedgerState { get; set; }

/// <summary>
/// Total number of items in underlying collection, fragment of which is available in &#x60;items&#x60; collection.
/// </summary>
/// <value>Total number of items in underlying collection, fragment of which is available in &#x60;items&#x60; collection.</value>
[DataMember(Name = "total_count", EmitDefaultValue = true)]
public long? TotalCount { get; set; }

/// <summary>
/// If specified, contains a cursor to query next page of the &#x60;items&#x60; collection.
/// </summary>
Expand All @@ -161,7 +152,6 @@ public override string ToString()
StringBuilder sb = new StringBuilder();
sb.Append("class StreamTransactionsResponse {\n");
sb.Append(" LedgerState: ").Append(LedgerState).Append("\n");
sb.Append(" TotalCount: ").Append(TotalCount).Append("\n");
sb.Append(" NextCursor: ").Append(NextCursor).Append("\n");
sb.Append(" Items: ").Append(Items).Append("\n");
sb.Append("}\n");
Expand Down Expand Up @@ -204,11 +194,6 @@ public bool Equals(StreamTransactionsResponse input)
(this.LedgerState != null &&
this.LedgerState.Equals(input.LedgerState))
) &&
(
this.TotalCount == input.TotalCount ||
(this.TotalCount != null &&
this.TotalCount.Equals(input.TotalCount))
) &&
(
this.NextCursor == input.NextCursor ||
(this.NextCursor != null &&
Expand All @@ -235,10 +220,6 @@ public override int GetHashCode()
{
hashCode = (hashCode * 59) + this.LedgerState.GetHashCode();
}
if (this.TotalCount != null)
{
hashCode = (hashCode * 59) + this.TotalCount.GetHashCode();
}
if (this.NextCursor != null)
{
hashCode = (hashCode * 59) + this.NextCursor.GetHashCode();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,17 +103,26 @@ protected StreamTransactionsResponseAllOf() { }
/// <summary>
/// Initializes a new instance of the <see cref="StreamTransactionsResponseAllOf" /> class.
/// </summary>
/// <param name="nextCursor">If specified, contains a cursor to query next page of the &#x60;items&#x60; collection..</param>
/// <param name="items">The page of user transactions. (required).</param>
public StreamTransactionsResponseAllOf(List<CommittedTransactionInfo> items = default(List<CommittedTransactionInfo>))
public StreamTransactionsResponseAllOf(string nextCursor = default(string), List<CommittedTransactionInfo> items = default(List<CommittedTransactionInfo>))
{
// to ensure "items" is required (not null)
if (items == null)
{
throw new ArgumentNullException("items is a required property for StreamTransactionsResponseAllOf and cannot be null");
}
this.Items = items;
this.NextCursor = nextCursor;
}

/// <summary>
/// If specified, contains a cursor to query next page of the &#x60;items&#x60; collection.
/// </summary>
/// <value>If specified, contains a cursor to query next page of the &#x60;items&#x60; collection.</value>
[DataMember(Name = "next_cursor", EmitDefaultValue = true)]
public string NextCursor { get; set; }

/// <summary>
/// The page of user transactions.
/// </summary>
Expand All @@ -129,6 +138,7 @@ public override string ToString()
{
StringBuilder sb = new StringBuilder();
sb.Append("class StreamTransactionsResponseAllOf {\n");
sb.Append(" NextCursor: ").Append(NextCursor).Append("\n");
sb.Append(" Items: ").Append(Items).Append("\n");
sb.Append("}\n");
return sb.ToString();
Expand Down Expand Up @@ -165,6 +175,11 @@ public bool Equals(StreamTransactionsResponseAllOf input)
return false;
}
return
(
this.NextCursor == input.NextCursor ||
(this.NextCursor != null &&
this.NextCursor.Equals(input.NextCursor))
) &&
(
this.Items == input.Items ||
this.Items != null &&
Expand All @@ -182,6 +197,10 @@ public override int GetHashCode()
unchecked // Overflow is fine, just wrap
{
int hashCode = 41;
if (this.NextCursor != null)
{
hashCode = (hashCode * 59) + this.NextCursor.GetHashCode();
}
if (this.Items != null)
{
hashCode = (hashCode * 59) + this.Items.GetHashCode();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,35 +103,17 @@ protected TwoWayLinkedDappsCollection() { }
/// <summary>
/// Initializes a new instance of the <see cref="TwoWayLinkedDappsCollection" /> class.
/// </summary>
/// <param name="totalCount">Total number of items in underlying collection, fragment of which is available in &#x60;items&#x60; collection..</param>
/// <param name="nextCursor">If specified, contains a cursor to query next page of the &#x60;items&#x60; collection..</param>
/// <param name="items">items (required).</param>
public TwoWayLinkedDappsCollection(long? totalCount = default(long?), string nextCursor = default(string), List<TwoWayLinkedDappsCollectionItem> items = default(List<TwoWayLinkedDappsCollectionItem>))
public TwoWayLinkedDappsCollection(List<TwoWayLinkedDappsCollectionItem> items = default(List<TwoWayLinkedDappsCollectionItem>))
{
// to ensure "items" is required (not null)
if (items == null)
{
throw new ArgumentNullException("items is a required property for TwoWayLinkedDappsCollection and cannot be null");
}
this.Items = items;
this.TotalCount = totalCount;
this.NextCursor = nextCursor;
}

/// <summary>
/// Total number of items in underlying collection, fragment of which is available in &#x60;items&#x60; collection.
/// </summary>
/// <value>Total number of items in underlying collection, fragment of which is available in &#x60;items&#x60; collection.</value>
[DataMember(Name = "total_count", EmitDefaultValue = true)]
public long? TotalCount { get; set; }

/// <summary>
/// If specified, contains a cursor to query next page of the &#x60;items&#x60; collection.
/// </summary>
/// <value>If specified, contains a cursor to query next page of the &#x60;items&#x60; collection.</value>
[DataMember(Name = "next_cursor", EmitDefaultValue = true)]
public string NextCursor { get; set; }

/// <summary>
/// Gets or Sets Items
/// </summary>
Expand All @@ -146,8 +128,6 @@ public override string ToString()
{
StringBuilder sb = new StringBuilder();
sb.Append("class TwoWayLinkedDappsCollection {\n");
sb.Append(" TotalCount: ").Append(TotalCount).Append("\n");
sb.Append(" NextCursor: ").Append(NextCursor).Append("\n");
sb.Append(" Items: ").Append(Items).Append("\n");
sb.Append("}\n");
return sb.ToString();
Expand Down Expand Up @@ -184,16 +164,6 @@ public bool Equals(TwoWayLinkedDappsCollection input)
return false;
}
return
(
this.TotalCount == input.TotalCount ||
(this.TotalCount != null &&
this.TotalCount.Equals(input.TotalCount))
) &&
(
this.NextCursor == input.NextCursor ||
(this.NextCursor != null &&
this.NextCursor.Equals(input.NextCursor))
) &&
(
this.Items == input.Items ||
this.Items != null &&
Expand All @@ -211,14 +181,6 @@ public override int GetHashCode()
unchecked // Overflow is fine, just wrap
{
int hashCode = 41;
if (this.TotalCount != null)
{
hashCode = (hashCode * 59) + this.TotalCount.GetHashCode();
}
if (this.NextCursor != null)
{
hashCode = (hashCode * 59) + this.NextCursor.GetHashCode();
}
if (this.Items != null)
{
hashCode = (hashCode * 59) + this.Items.GetHashCode();
Expand Down
Loading

0 comments on commit 967dfe3

Please sign in to comment.