| 1 | =begin comment | ||
| 2 | |||
| 3 | Aspose.Diagram Cloud API Reference | ||
| 4 | |||
| 5 | No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) | ||
| 6 | |||
| 7 | OpenAPI spec version: 3.0 | ||
| 8 | |||
| 9 | Generated by: https://github.com/swagger-api/swagger-codegen.git | ||
| 10 | |||
| 11 | =end comment | ||
| 12 | |||
| 13 | =cut | ||
| 14 | |||
| 15 | # | ||
| 16 | # NOTE: This class is auto generated by the swagger code generator program. | ||
| 17 | # Do not edit the class manually. | ||
| 18 | # Ref: https://github.com/swagger-api/swagger-codegen | ||
| 19 | # | ||
| 20 | package AsposeDiagramCloud::Object::ObjectExist; | ||
| 21 | |||
| 22 | require 5.6.0; | ||
| 23 | use strict; | ||
| 24 | use warnings; | ||
| 25 | use utf8; | ||
| 26 | use JSON qw(decode_json); | ||
| 27 | use Data::Dumper; | ||
| 28 | use Module::Runtime qw(use_module); | ||
| 29 | use Log::Any qw($log); | ||
| 30 | use Date::Parse; | ||
| 31 | use DateTime; | ||
| 32 | |||
| 33 | |||
| 34 | use base ("Class::Accessor", "Class::Data::Inheritable"); | ||
| 35 | |||
| 36 | |||
| 37 | # | ||
| 38 | #Object exists | ||
| 39 | # | ||
| 40 | # NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually. | ||
| 41 | # REF: https://github.com/swagger-api/swagger-codegen | ||
| 42 | # | ||
| 43 | |||
| 44 | =begin comment | ||
| 45 | |||
| 46 | Aspose.Diagram Cloud API Reference | ||
| 47 | |||
| 48 | No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) | ||
| 49 | |||
| 50 | OpenAPI spec version: 3.0 | ||
| 51 | |||
| 52 | Generated by: https://github.com/swagger-api/swagger-codegen.git | ||
| 53 | |||
| 54 | =end comment | ||
| 55 | |||
| 56 | =cut | ||
| 57 | |||
| 58 | # | ||
| 59 | # NOTE: This class is auto generated by the swagger code generator program. | ||
| 60 | # Do not edit the class manually. | ||
| 61 | # Ref: https://github.com/swagger-api/swagger-codegen | ||
| 62 | # | ||
| 63 | __PACKAGE__->mk_classdata('attribute_map' => {}); | ||
| 64 | __PACKAGE__->mk_classdata('swagger_types' => {}); | ||
| 65 | __PACKAGE__->mk_classdata('method_documentation' => {}); | ||
| 66 | __PACKAGE__->mk_classdata('class_documentation' => {}); | ||
| 67 | |||
| 68 | # new object | ||
| 69 | sub new { | ||
| 70 | my ($class, %args) = @_; | ||
| 71 | |||
| 72 | my $self = bless {}, $class; | ||
| 73 | |||
| 74 | foreach my $attribute (keys %{$class->attribute_map}) { | ||
| 75 | my $args_key = $class->attribute_map->{$attribute}; | ||
| 76 | $self->$attribute( $args{ $args_key } ); | ||
| 77 | } | ||
| 78 | |||
| 79 | return $self; | ||
| 80 | } | ||
| 81 | |||
| 82 | # return perl hash | ||
| 83 | sub to_hash { | ||
| 84 | return decode_json(JSON->new->convert_blessed->encode( shift )); | ||
| 85 | } | ||
| 86 | |||
| 87 | # used by JSON for serialization | ||
| 88 | sub TO_JSON { | ||
| 89 | my $self = shift; | ||
| 90 | my $_data = {}; | ||
| 91 | foreach my $_key (keys %{$self->attribute_map}) { | ||
| 92 | if (defined $self->{$_key}) { | ||
| 93 | $_data->{$self->attribute_map->{$_key}} = $self->{$_key}; | ||
| 94 | } | ||
| 95 | } | ||
| 96 | return $_data; | ||
| 97 | } | ||
| 98 | |||
| 99 | # from Perl hashref | ||
| 100 | sub from_hash { | ||
| 101 | my ($self, $hash) = @_; | ||
| 102 | |||
| 103 | # loop through attributes and use swagger_types to deserialize the data | ||
| 104 | while ( my ($_key, $_type) = each %{$self->swagger_types} ) { | ||
| 105 | my $_json_attribute = $self->attribute_map->{$_key}; | ||
| 106 | if ($_type =~ /^array\[/i) { # array | ||
| 107 | my $_subclass = substr($_type, 6, -1); | ||
| 108 | my @_array = (); | ||
| 109 | foreach my $_element (@{$hash->{$_json_attribute}}) { | ||
| 110 | push @_array, $self->_deserialize($_subclass, $_element); | ||
| 111 | } | ||
| 112 | $self->{$_key} = \@_array; | ||
| 113 | } elsif (exists $hash->{$_json_attribute}) { #hash(model), primitive, datetime | ||
| 114 | $self->{$_key} = $self->_deserialize($_type, $hash->{$_json_attribute}); | ||
| 115 | } else { | ||
| 116 | $log->debugf("Warning: %s (%s) does not exist in input hash\n", $_key, $_json_attribute); | ||
| 117 | } | ||
| 118 | } | ||
| 119 | |||
| 120 | return $self; | ||
| 121 | } | ||
| 122 | |||
| 123 | # deserialize non-array data | ||
| 124 | sub _deserialize { | ||
| 125 | my ($self, $type, $data) = @_; | ||
| 126 | $log->debugf("deserializing %s with %s",Dumper($data), $type); | ||
| 127 | |||
| 128 | if ($type eq 'DateTime') { | ||
| 129 | return DateTime->from_epoch(epoch => str2time($data)); | ||
| 130 | } elsif ( grep( /^$type$/, ('int', 'double', 'string', 'boolean'))) { | ||
| 131 | return $data; | ||
| 132 | } else { # hash(model) | ||
| 133 | my $_instance = eval "AsposeDiagramCloud::Object::$type->new()"; | ||
| 134 | return $_instance->from_hash($data); | ||
| 135 | } | ||
| 136 | } | ||
| 137 | |||
| 138 | |||
| 139 | |||
| 140 | __PACKAGE__->class_documentation({description => 'Object exists', | ||
| 141 | class => 'ObjectExist', | ||
| 142 | required => [], # TODO | ||
| 143 | } ); | ||
| 144 | |||
| 145 | __PACKAGE__->method_documentation({ | ||
| 146 | 'exists' => { | ||
| 147 | datatype => 'boolean', | ||
| 148 | base_name => 'Exists', | ||
| 149 | description => 'Indicates that the file or folder exists.', | ||
| 150 | format => '', | ||
| 151 | read_only => '', | ||
| 152 | }, | ||
| 153 | 'is_folder' => { | ||
| 154 | datatype => 'boolean', | ||
| 155 | base_name => 'IsFolder', | ||
| 156 | description => 'True if it is a folder, false if it is a file.', | ||
| 157 | format => '', | ||
| 158 | read_only => '', | ||
| 159 | }, | ||
| 160 | }); | ||
| 161 | |||
| 162 | __PACKAGE__->swagger_types( { | ||
| 163 | 'exists' => 'boolean', | ||
| 164 | 'is_folder' => 'boolean' | ||
| 165 | } ); | ||
| 166 | |||
| 167 | __PACKAGE__->attribute_map( { | ||
| 168 | 'exists' => 'Exists', | ||
| 169 | 'is_folder' => 'IsFolder' | ||
| 170 | } ); | ||
| 171 | |||
| 172 | __PACKAGE__->mk_accessors(keys %{__PACKAGE__->attribute_map}); | ||
| 173 | |||
| 174 | |||
| 175 | 1; |