createUsers static method

XmlDocumentFragment createUsers(
  1. List<User> users
)

XML for the createUsers

Implementation

static XmlDocumentFragment createUsers(List<User> users) {
  Transport.builder.element('CreateUsers', nest: () {
    Transport.builder.namespace(Xmlns.tds);

    for (var user in users) {
      Transport.builder.element('User', nest: () {
        Transport.builder.namespace(Xmlns.tds);
        Transport.builder.element('Username', nest: () {
          Transport.builder.namespace(Xmlns.tt);
          Transport.builder.text(user.username);
        });

        if (user.password != null) {
          Transport.builder.element('Password', nest: () {
            Transport.builder.namespace(Xmlns.tt);
            Transport.builder.text(user.password!);
          });
        }

        Transport.builder.element('UserLevel', nest: () {
          Transport.builder.namespace(Xmlns.tt);
          Transport.builder.text(user.userLevel.code);
        });
      });
    }
  });

  return Transport.builder.buildFragment();
}