public CreateAlbumsResponse createAlbums(
      @NotNull final String jobId,
      @NotNull final String dataClass,
      @NotNull final Collection<MediaAlbum> mediaAlbums)
      throws IOException, CopyExceptionWithFailureReason {
    final CreateAlbumsRequest.Builder createAlbumsRequestBuilder = CreateAlbumsRequest.newBuilder();

    // take jobId as importSessionId
    createAlbumsRequestBuilder.setImportSessionId(jobId);

    // validate export service
    if (JobMetadata.isInitialized() && JobMetadata.getExportService() != null) {
      createAlbumsRequestBuilder.setExportService(JobMetadata.getExportService());
    }

    createAlbumsRequestBuilder.setDataClass(dataClass);

    createAlbumsRequestBuilder.addAllNewPhotoAlbumRequests(
      mediaAlbums.stream()
        .map(
          mediaAlbum -> NewPhotoAlbumRequest.newBuilder()
            .setDataId(mediaAlbum.getId())
            .setName(Optional.ofNullable(mediaAlbum.getName()).orElse(""))
            .build())
        .collect(Collectors.toList()));
    CreateAlbumsRequest createAlbumsRequest = createAlbumsRequestBuilder.build();
    final byte[] payload = createAlbumsRequest.toByteArray();
    final byte[] responseData = makePhotosServicePostRequest(baseUrl + "createalbums", payload);
    return CreateAlbumsResponse.parseFrom(responseData);
  }
An interface that is synonymous to HTTP client to interact with the Apple Photos APIs.
extensions/data-transfer/portability-data-transfer-apple/src/main/java/org/datatransferproject/datatransfer/apple/photos/AppleMediaInterface.java