encode<V> static method

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

Implementation

static V encode<V>(
  Capability instance,
  Encoder<V> encoder,
) {
  final container = encoder.container<String>();
  AccountOrId.encode(
    instance.account,
    container.nestedSingleValueContainer('account').encoder,
  );
  if (instance.futureRequirements != null) {
    AccountCapabilityFutureRequirements.encode(
      instance.futureRequirements!,
      container.nestedSingleValueContainer('future_requirements').encoder,
    );
  }
  container.encodeString(
    'id',
    instance.id,
  );
  container.encodeString(
    'object',
    'capability',
  );
  container.encodeBool(
    'requested',
    instance.requested,
  );
  if (instance.requestedAt != null) {
    container.encodeDateTime(
      'requested_at',
      instance.requestedAt!,
    );
  }
  if (instance.requirements != null) {
    AccountCapabilityRequirements.encode(
      instance.requirements!,
      container.nestedSingleValueContainer('requirements').encoder,
    );
  }
  container.encodeString(
    'status',
    instance.status,
  );
  return container.value;
}