encode<V> static method

V encode<V>(
  1. GetSubscriptionsSearchResponse instance,
  2. Encoder<V> encoder
)

Implementation

static V encode<V>(
  GetSubscriptionsSearchResponse instance,
  Encoder<V> encoder,
) {
  final container = encoder.container<String>();
  container.encodeList(
    'data',
    (container) => instance.data.forEach((el) => Subscription.encode(
          el,
          container.nestedSingleValueContainer().encoder,
        )),
  );
  container.encodeBool(
    'has_more',
    instance.hasMore,
  );
  if (instance.nextPage != null) {
    container.encodeString(
      'next_page',
      instance.nextPage!,
    );
  }
  container.encodeString(
    'object',
    'search_result',
  );
  if (instance.totalCount != null) {
    container.encodeInt(
      'total_count',
      instance.totalCount!,
    );
  }
  container.encodeString(
    'url',
    instance.url,
  );
  return container.value;
}