createFamily method

Future<ClientResponse<FamilyResponse, Errors>> createFamily(
  1. String familyId,
  2. FamilyRequest request
)

Creates a family with the user id in the request as the owner and sole member of the family. You can optionally specify an id for the family, if not provided one will be generated.

@param {String} familyId (Optional) The id for the family. If not provided a secure random UUID will be generated. @param {FamilyRequest} request The request object that contains all the information used to create the family. @returns {Promise<ClientResponse

Implementation

Future<ClientResponse<FamilyResponse, Errors>> createFamily(
    String familyId, FamilyRequest request) {
  return _start<FamilyResponse, Errors>()
      .withUri('/api/user/family')
      .withUriSegment(familyId)
      .withJSONBody(request)
      .withMethod('POST')
      .withResponseHandler(
          defaultResponseHandlerBuilder((d) => FamilyResponse.fromJson(d)))
      .go();
}