encode<V> static method

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

Implementation

static V encode<V>(
  AccountUpdateOptions instance,
  Encoder<V> encoder,
) {
  final container = encoder.container<String>();
  if (instance.accountToken != null) {
    container.encodeString(
      'account_token',
      instance.accountToken!,
    );
  }
  if (instance.businessProfile != null) {
    AccountCreateOptionsBusinessProfile.encode(
      instance.businessProfile!,
      container.nestedSingleValueContainer('business_profile').encoder,
    );
  }
  if (instance.businessType != null) {
    AccountCreateOptionsBusinessType.encode(
      instance.businessType!,
      container.nestedSingleValueContainer('business_type').encoder,
    );
  }
  if (instance.capabilities != null) {
    AccountCapabilities.encode(
      instance.capabilities!,
      container.nestedSingleValueContainer('capabilities').encoder,
    );
  }
  if (instance.company != null) {
    AccountCompany.encode(
      instance.company!,
      container.nestedSingleValueContainer('company').encoder,
    );
  }
  if (instance.defaultCurrency != null) {
    container.encodeString(
      'default_currency',
      instance.defaultCurrency!,
    );
  }
  if (instance.documents != null) {
    AccountDocuments.encode(
      instance.documents!,
      container.nestedSingleValueContainer('documents').encoder,
    );
  }
  if (instance.email != null) {
    container.encodeString(
      'email',
      instance.email!,
    );
  }
  if (instance.expand != null) {
    container.encodeList(
      'expand',
      (container) =>
          instance.expand!.forEach((el) => container.encodeString(el)),
    );
  }
  if (instance.externalAccount != null) {
    container.encodeString(
      'external_account',
      instance.externalAccount!,
    );
  }
  if (instance.individual != null) {
    AccountIndividual.encode(
      instance.individual!,
      container.nestedSingleValueContainer('individual').encoder,
    );
  }
  if (instance.metadata != null) {
    container.encodeMap(
      'metadata',
      (container) => instance.metadata!.forEach((
        key,
        value,
      ) =>
          container.encodeString(
            key,
            value,
          )),
    );
  }
  if (instance.settings != null) {
    AccountUpdateOptionsSettings.encode(
      instance.settings!,
      container.nestedSingleValueContainer('settings').encoder,
    );
  }
  if (instance.tosAcceptance != null) {
    AccountCreateOptionsTosAcceptance.encode(
      instance.tosAcceptance!,
      container.nestedSingleValueContainer('tos_acceptance').encoder,
    );
  }
  return container.value;
}