File Coverage

blib/lib/Slack/BlockKit/Types.pm
Criterion Covered Total %
statement 11 11 100.0
branch n/a
condition n/a
subroutine 4 4 100.0
pod n/a
total 15 15 100.0


line stmt bran cond sub pod time code
1             package Slack::BlockKit::Types 0.005;
2             # ABSTRACT: Moose type constraints used internally by Slack::Block Kit
3 4     4   48 use v5.36.0;
  4         14  
4              
5             #pod =head1 OVERVIEW
6             #pod
7             #pod This library has some types used by Slack::BlockKit. Generally, you shouldn't
8             #pod need to think about them, and they're not being documented, so that they can be
9             #pod rejiggered whenever convenient. You can always read the source!
10             #pod
11             #pod =cut
12              
13 4         40 use MooseX::Types -declare => [qw(
14             RichTextBlocks
15             ExpansiveElementList
16             ContextElementList
17             Pixels
18             RichTextArray
19             RichTextStyle
20             RichTextMentionStyle
21 4     4   19 )];
  4         8  
22              
23 4     4   25586 use MooseX::Types::Moose qw(ArrayRef Bool Int);
  4         9  
  4         35  
24 4     4   20709 use MooseX::Types::Structured qw(Dict Optional);
  4         1593395  
  4         29  
25              
26             subtype RichTextBlocks, as ArrayRef[
27             union([
28             map {; class_type("Slack::BlockKit::Block::RichText::$_") }
29             (qw( List Quote Preformatted Section ))
30             ])
31             ];
32              
33             subtype ExpansiveElementList, as ArrayRef[
34             union([
35             map {; class_type("Slack::BlockKit::Block::RichText::$_") }
36             (qw( Channel Date Emoji Link Text User UserGroup ))
37             ])
38             ];
39              
40             subtype ContextElementList, as ArrayRef[
41             # This should really be union-ed with Image, but we don't have an Image type,
42             # so there you go. -- rjbs, 2025-08-12
43             class_type("Slack::BlockKit::CompObj::Text"),
44             ];
45              
46             subtype RichTextArray, as ArrayRef[
47             class_type("Slack::BlockKit::Block::RichText::Section")
48             ];
49              
50             subtype Pixels, as Int, where { $_ >= 0 },
51             message { "Pixel attributes must be integers, >= 0" };
52              
53             # RichListStyle - enum( ordered, bullet )
54              
55             1;
56              
57             __END__
58              
59             =pod
60              
61             =encoding UTF-8
62              
63             =head1 NAME
64              
65             Slack::BlockKit::Types - Moose type constraints used internally by Slack::Block Kit
66              
67             =head1 VERSION
68              
69             version 0.005
70              
71             =head1 OVERVIEW
72              
73             This library has some types used by Slack::BlockKit. Generally, you shouldn't
74             need to think about them, and they're not being documented, so that they can be
75             rejiggered whenever convenient. You can always read the source!
76              
77             =head1 PERL VERSION
78              
79             This module should work on any version of perl still receiving updates from
80             the Perl 5 Porters. This means it should work on any version of perl
81             released in the last two to three years. (That is, if the most recently
82             released version is v5.40, then this module should work on both v5.40 and
83             v5.38.)
84              
85             Although it may work on older versions of perl, no guarantee is made that the
86             minimum required version will not be increased. The version may be increased
87             for any reason, and there is no promise that patches will be accepted to
88             lower the minimum required perl.
89              
90             =head1 AUTHOR
91              
92             Ricardo SIGNES <cpan@semiotic.systems>
93              
94             =head1 COPYRIGHT AND LICENSE
95              
96             This software is copyright (c) 2024 by Ricardo SIGNES.
97              
98             This is free software; you can redistribute it and/or modify it under
99             the same terms as the Perl 5 programming language system itself.
100              
101             =cut