@@ -23,8 +23,8 @@ export default class AppleTag extends Tag {
2323 private readonly _ilstBox : AppleItemListBox ;
2424
2525 /**
26- * Constructs and initializes a new instance of @see AppleTag for a specified ISO user data box.
27- * @param box A @see IsoUserDataBox from which the tag is to be read.
26+ * Constructs and initializes a new instance of { @link AppleTag} for a specified ISO user data box.
27+ * @param box A { @link IsoUserDataBox} from which the tag is to be read.
2828 */
2929 public constructor ( box : IsoUserDataBox ) {
3030 super ( ) ;
@@ -505,16 +505,37 @@ export default class AppleTag extends Tag {
505505
506506 // #region Public Methods
507507
508+ /**
509+ * Gets all strings from the iTunes boxes with the given MEAN/NAME combination.
510+ * @param meanString MEAN box contents to look for
511+ * @param nameString NAME box contents to look for
512+ * @returns string[] Text contents of the iTunes boxes with the given NAME/MEAN combination or
513+ * `[]` if there are no matches.
514+ */
508515 public getItunesStrings ( meanString : string , nameString : string ) : string [ ] {
516+ // @TODO : You know, MEAN is the same for every known box. Maybe we can just drop it.
509517 return this . _ilstBox . getItunesTagDataBoxes ( meanString , nameString )
510518 . filter ( b => NumberUtils . hasFlag ( b . flags , AppleDataBoxFlagType . ContainsText , true ) )
511519 . map ( b => b . text ) ;
512520 }
513521
522+ /**
523+ * Gets the first string from the iTunes boxes with the given MEAN/NAME combination.
524+ * @param meanString MEAN box contents to search for
525+ * @param nameString NAME box contents to search for
526+ * @returns string Text contents of the first iTunes box found with the given MEAN/NAME
527+ * combination or `undefined` if no matches found.
528+ */
514529 public getFirstItunesString ( meanString : string , nameString : string ) : string {
515530 return this . getItunesStrings ( meanString , nameString ) [ 0 ] ;
516531 }
517532
533+ /**
534+ * Gets the text contents of all boxes with the given `boxType` inside the tag's ILST box.
535+ * @param boxType Type of box to search for
536+ * @returns string[] Text contents of all boxes with the given `boxType` or `undefined` if no
537+ * matches were found.
538+ */
518539 public getQuickTimeStrings ( boxType : ByteVector ) : string [ ] {
519540 return this . _ilstBox . getQuickTimeDataBoxes ( boxType )
520541 . filter ( b => NumberUtils . hasFlag ( b . flags , AppleDataBoxFlagType . ContainsText , true ) )
@@ -529,6 +550,14 @@ export default class AppleTag extends Tag {
529550 } , [ ] ) ;
530551 }
531552
553+ /**
554+ * Gets the raw data of all boxes within this tag's ILST box of the given `boxType`, optionally
555+ * matching the provided `flags
556+ * @param boxType Type of box to search for
557+ * @param flags Optional, box flags to search for. Defaults to
558+ * {@link AppleDataBoxFlagType.ContainsData}
559+ * @returns ByteVector[] Raw contents of the matching boxes, `[]` if no matches are found.
560+ */
532561 public getQuickTimeData (
533562 boxType : ByteVector ,
534563 flags : AppleDataBoxFlagType = AppleDataBoxFlagType . ContainsData
@@ -538,10 +567,25 @@ export default class AppleTag extends Tag {
538567 . map ( b => b . data ) ;
539568 }
540569
570+ /**
571+ * Gets the text contents of the first box within this tag's ILST box that matches the provided
572+ * `boxType`.
573+ * @param boxType Type of the box to search for.
574+ * @returns string Text contents of the first matching box. `undefined` if no matches are found
575+ */
541576 public getFirstQuickTimeString ( boxType : ByteVector ) : string {
542577 return this . getQuickTimeStrings ( boxType ) [ 0 ] ;
543578 }
544579
580+ /**
581+ * Gets the raw data contents of the first box within this tag's ILST box that matches the
582+ * provided `boxType`, optionally matching `flags` and a predicate.
583+ * @param boxType Type of box to search for
584+ * @param flags Optional flags to match, defaults to {@see AppleDataBoxFlagType.ContainsData}
585+ * @param predicate Optional additional criteria the box must match
586+ * @returns ByteVector Raw data contents of the first matching box. `undefined` if no matches
587+ * are found
588+ */
545589 public getFirstQuickTimeData (
546590 boxType : ByteVector ,
547591 flags : AppleDataBoxFlagType = AppleDataBoxFlagType . ContainsData ,
@@ -553,10 +597,26 @@ export default class AppleTag extends Tag {
553597 : data [ 0 ] ;
554598 }
555599
600+ /**
601+ * Stores the provided `dataStrings` in iTunes boxes with the provided MEAN and NAME strings.
602+ * This replaces any existing boxes.
603+ * @param meanString MEAN box contents to set
604+ * @param nameString NAME box contents to set
605+ * @param dataStrings Contents of the iTunes box to store. Use `[]` or `undefined` to clear
606+ * the existing contents and leave empty.
607+ */
556608 public setItunesStrings ( meanString : string , nameString : string , ...dataStrings : string [ ] ) : void {
557609 this . _ilstBox . setItunesTagBoxes ( meanString , nameString , dataStrings ) ;
558610 }
559611
612+ /**
613+ * Stores the provided `data` in boxes with the provided box type. If `flags` are provided, the
614+ * DATA boxes created to store `data` will have the `flags` applied to them. This replaces all
615+ * existing boxes of the given type.
616+ * @param boxType Type of the box to set
617+ * @param data Data to store in the boxes
618+ * @param flags Optional, flags to set on the DATA boxes
619+ */
560620 public setQuickTimeData (
561621 boxType : ByteVector ,
562622 data : ByteVector [ ] ,
@@ -566,10 +626,23 @@ export default class AppleTag extends Tag {
566626 this . _ilstBox . setQuickTimeBoxes ( boxType , dataBoxes ) ;
567627 }
568628
629+ /**
630+ * Stores the provided string in a box with the provided box type. This replaces all boxes of
631+ * the given type with a single box containing the provided data.
632+ * @param boxType Type of box to set
633+ * @param dataString Contents to store in the box
634+ */
569635 public setQuickTimeString ( boxType : ByteVector , dataString : string ) : void {
570636 this . setQuickTimeStrings ( boxType , dataString ? [ dataString ] : undefined ) ;
571637 }
572638
639+ /**
640+ * Stores the provided strings in boxes with the provided box type. This replaces all boxes of
641+ * the given type with a single box of the given type containing a DATA box for each of the
642+ * provided `dataStrings`.
643+ * @param boxType Type of box to set
644+ * @param dataStrings Contents to store in the box
645+ */
573646 public setQuickTimeStrings ( boxType : ByteVector , dataStrings : string [ ] ) : void {
574647 let dataBoxes : AppleDataBox [ ] ;
575648 if ( ! ArrayUtils . isFalsyOrEmpty ( dataStrings ) ) {
@@ -587,6 +660,7 @@ export default class AppleTag extends Tag {
587660
588661 /**
589662 * Detaches the internal "ilst" box from its parent element.
663+ * @internal
590664 */
591665 public detachIlst ( ) : void {
592666 this . _metaBox . removeChildByBox ( this . _ilstBox ) ;
0 commit comments