MediaUploadComplete media.upload-complete@1

Generated at from openvibe-contracts v0.419.0 and openvibe-sdk v0.161.0.

Version
1.0.0
Owner
media
Visibility
public
Status
active
Compatibility
backward
Schema
https://openvibe.network/contracts/media/upload-complete.v1.json

Complete an upload after all parts arrive. Media assembles the bytes, verifies the optional hashes and content type, and returns the ready object.

Fields

FieldTypeRequiredDescriptionConstraints
content_hashstring
  • pattern ^[a-fA-F0-9]{64}$
partsarray of object
  • items: no other fields
parts[].part_numberintegeryes
  • minimum 1
parts[].sha256stringyes
  • pattern ^[a-f0-9]{64}$

Examples

From the contract's own test fixtures: valid ones validate, rejected ones must fail.

Valid: basic
{
  "parts": [
    {
      "part_number": 1,
      "sha256": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
    }
  ]
}
Rejected: basic
{
  "parts": [
    {}
  ]
}

Validate

const contracts = require('openvibe-contracts');
contracts.validate('media.upload-complete@1', value);   // { valid, errors: [{ path, message }] }