Hс_domain_calendar_set

Команда позволяет изменять настройки календаря на уровне домена.

Аналог команды в CoCon:

/domain/<DOMAIN>/calendar/set

Метод HTTP-запроса:

POST

Шаблон HTTP-запроса:

http://host:port/commands/domain_calendar_set

Код HTTP-ответа:

  • 200 – в случае успеха;
  • 404 – в случае ошибки.

XSD-схема XML-файла запроса/ответа:

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema
    xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <!-- maskType-->
    <xs:complexType name="maskType">
        <xs:attribute name="year" type="xs:string"/>
        <xs:attribute name="month" type="xs:string"/>
        <xs:attribute name="day" type="xs:string"/>
        <xs:attribute name="day_of_week" type="xs:string"/>
        <xs:attribute name="day_of_year" type="xs:string"/>
    </xs:complexType>
    <!-- defaultType-->
    <xs:complexType name="defaultType">
        <xs:all>
            <xs:element name="mask" type="maskType" minOccurs="0"/>
            <xs:element name="day" type="maskdayType" minOccurs="0"/>
        </xs:all>
    </xs:complexType>
    <!-- defaultsType-->
    <xs:complexType name="defaultsType">
        <xs:sequence>
            <xs:element name="default" type="defaultType" minOccurs="0" maxOccurs="unbounded"/>
        </xs:sequence>
    </xs:complexType>
    <!-- propertieType-->
    <xs:complexType name="propertyType">
        <xs:attribute name="key" type="xs:string"/>
        <xs:attribute name="value" type="xs:string"/>
    </xs:complexType>
    <!-- propertiesType-->
    <xs:complexType name="propertiesType">
        <xs:sequence>
            <xs:element name="property" type="propertyType" minOccurs="0" maxOccurs="unbounded"/>
        </xs:sequence>
    </xs:complexType>
    <!-- typeType-->
    <xs:simpleType name="typeType">
        <xs:restriction base="xs:string">
            <xs:enumeration value="HALF-WORK"/>
            <xs:enumeration value="WORK"/>
            <xs:enumeration value="DAY-OFF"/>
            <xs:enumeration value="HALF-HOLIDAY"/>
            <xs:enumeration value="HOLIDAY"/>
            <xs:enumeration value="HALF-WORK-AND-HOLIDAY"/>
        </xs:restriction>
    </xs:simpleType>
    <!-- maskdayType-->
    <xs:complexType name="maskdayType">
        <xs:all>
            <xs:element name="properties" type="propertiesType" minOccurs="0"/>
        </xs:all>
        <xs:attribute name="date" type="xs:string"/>
        <xs:attribute name="type" type="typeType"/>
    </xs:complexType>
    <!-- dayType-->
    <xs:complexType name="dayType">
        <xs:all>
            <xs:element name="properties" type="propertiesType" minOccurs="0"/>
        </xs:all>
        <xs:attribute name="year" type="xs:string"/>
        <xs:attribute name="month" type="xs:string"/>
        <xs:attribute name="day" type="xs:string"/>
        <xs:attribute name="type" type="typeType"/>
    </xs:complexType>
    <!-- daysType-->
    <xs:complexType name="daysType">
        <xs:sequence>
            <xs:element name="day" type="dayType" minOccurs="0" maxOccurs="unbounded"/>
        </xs:sequence>
    </xs:complexType>
    <!-- yearType-->
    <xs:complexType name="yearType">
        <xs:all>
            <xs:element name="days" type="daysType" minOccurs="0"/>
            <xs:element name="defaults" type="defaultsType" minOccurs="0"/>
            <xs:element name="properties" type="propertiesType" minOccurs="0"/>
        </xs:all>
        <xs:attribute name="year" type="xs:string"/>
    </xs:complexType>
    <!-- yearsType-->
    <xs:complexType name="yearsType">
        <xs:sequence>
            <xs:element name="year" type="yearType" minOccurs="0" maxOccurs="unbounded"/>
        </xs:sequence>
    </xs:complexType>
    <xs:complexType name="calendarType">
        <xs:all>
            <xs:element name="years" type="yearsType" minOccurs="0"/>
            <xs:element name="defaults" type="defaultsType" minOccurs="0"/>
            <xs:element name="properties" type="propertiesType" minOccurs="0"/>
        </xs:all>
        <xs:attribute name="timezone" type="xs:string"/>
    </xs:complexType>
    <!-- in-->
    <xs:element name="in">
        <xs:complexType>
            <xs:all>
                <xs:element name="request">
                    <xs:complexType>
                        <xs:all>
                            <xs:element name="calendar" type="calendarType"/>
                        </xs:all>
                        <xs:attribute name="domain" type="xs:string" use="optional"/>
                    </xs:complexType>
                </xs:element>
            </xs:all>
        </xs:complexType>
    </xs:element>
    <!-- out-->
    <xs:element name="out">
        <xs:complexType>
            <xs:choice>
                <!--Positive case-->
                <xs:element name="response">
                    <xs:complexType>
                        <xs:sequence>
                            <xs:element name="ok"/>
                        </xs:sequence>
                    </xs:complexType>
                </xs:element>
            </xs:choice>
        </xs:complexType>
    </xs:element>
</xs:schema>

CODE

Пример

Запрос: http://192.168.1.21:9999/commands/domain_calendar_set

<?xml version="1.0" encoding="UTF-8"?>
<in
    xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="hc_domain_calendar_set.xsd">
    <request domain="biysk.local">
        <calendar timezone="UTC+00:00">
            <years>
                <year year="2019">
                    <days>
                        <day year="2019" month="3" day="8" type="HOLIDAY">
                            <properties/>
                        </day>
                        <day year="2019" month="1" day="2" type="HOLIDAY">
                            <properties/>
                        </day>
                    </days>
                    <defaults/>
                    <properties/>
                </year>
                <year year="2020">
                    <days>
                        <day year="2020" month="9" day="18" type="HALF-WORK">
                            <properties/>
                        </day>
                        <day year="2020" month="3" day="7" type="HALF-HOLIDAY">
                            <properties/>
                        </day>
                    </days>
                    <defaults/>
                    <properties/>
                </year>
            </years>
            <defaults>
                <default>
                    <mask year="*" month="5" day="9" day_of_week="*" day_of_year="*"/>
                    <day date="*" type="HOLIDAY">
                        <properties/>
                    </day>
                </default>
                <default>
                    <mask year="*" month="1" day="*" day_of_week="*" day_of_year="8 9 10 11 12"/>
                    <day date="*" type="WORK">
                        <properties/>
                    </day>
                </default>
                <default>
                    <mask year="*" month="*" day="*" day_of_week="6 7" day_of_year="*"/>
                    <day date="*" type="DAY-OFF">
                        <properties/>
                    </day>
                </default>
            </defaults>
            <properties>
                <property key="description" value="Default system calendar"/>
            </properties>
        </calendar>
    </request>
</in>
CODE

Ответ:

200

<?xml version="1.0"?>
<out
    xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="hc_domain_calendar_set.xsd">
    <response>
        <ok/>
    </response>
</out>
CODE

Hс_domain_calendar_show

Команда для просмотра календаря домена.

Аналог команды в CoCon:

/domain/<DOMAIN>/calendar/show

Метод HTTP-запроса:

POST

Шаблон HTTP-запроса:

http://host:port/commands/domain_calendar_show

Код HTTP-ответа:

  • 200 – в случае успеха;
  • 404 – в случае ошибки.

XSD-схема XML-файла запроса/ответа:

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema
    xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <!-- maskType-->
    <xs:complexType name="maskType">
        <xs:attribute name="year" type="xs:string"/>
        <xs:attribute name="month" type="xs:string"/>
        <xs:attribute name="day" type="xs:string"/>
        <xs:attribute name="day_of_week" type="xs:string">
            <xs:annotation>
                <xs:documentation xml:lang="en">
                    Space delimetered list of days. 1 - monday, 7 - sunday
                    Example: 1 2 3 4 5
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute name="day_of_year" type="xs:string">
            <xs:annotation>
                <xs:documentation xml:lang="en">
                    Space delimetered list of days.
                    Example: 256 257
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
    </xs:complexType>
    <!-- defaultType-->
    <xs:complexType name="defaultType">
        <xs:all>
            <xs:element name="mask" type="maskType" minOccurs="0"/>
            <xs:element name="day" type="maskdayType" minOccurs="0"/>
        </xs:all>
    </xs:complexType>
    <!-- defaultsType-->
    <xs:complexType name="defaultsType">
        <xs:sequence>
            <xs:element name="default" type="defaultType" minOccurs="0" maxOccurs="unbounded"/>
        </xs:sequence>
    </xs:complexType>
    <!-- propertieType-->
    <xs:complexType name="propertyType">
        <xs:attribute name="key" type="xs:string"/>
        <xs:attribute name="value" type="xs:string"/>
    </xs:complexType>
    <!-- propertiesType-->
    <xs:complexType name="propertiesType">
        <xs:sequence>
            <xs:element name="property" type="propertyType" minOccurs="0" maxOccurs="unbounded"/>
        </xs:sequence>
    </xs:complexType>
    <!-- typeType-->
    <xs:simpleType name="typeType">
        <xs:restriction base="xs:string">
            <xs:enumeration value="HALF-WORK"/>
            <xs:enumeration value="WORK"/>
            <xs:enumeration value="DAY-OFF"/>
            <xs:enumeration value="HALF-HOLIDAY"/>
            <xs:enumeration value="HOLIDAY"/>
            <xs:enumeration value="HALF-WORK-AND-HOLIDAY"/>
        </xs:restriction>
    </xs:simpleType>
    <!-- maskdayType-->
    <xs:complexType name="maskdayType">
        <xs:all>
            <xs:element name="properties" type="propertiesType" minOccurs="0"/>
        </xs:all>
        <xs:attribute name="date" type="xs:string"/>
        <xs:attribute name="type" type="typeType"/>
    </xs:complexType>
    <!-- dayType-->
    <xs:complexType name="dayType">
        <xs:all>
            <xs:element name="properties" type="propertiesType" minOccurs="0"/>
        </xs:all>
        <xs:attribute name="year" type="xs:string"/>
        <xs:attribute name="month" type="xs:string"/>
        <xs:attribute name="day" type="xs:string"/>
        <xs:attribute name="type" type="typeType"/>
    </xs:complexType>
    <!-- daysType-->
    <xs:complexType name="daysType">
        <xs:sequence>
            <xs:element name="day" type="dayType" minOccurs="0" maxOccurs="unbounded"/>
        </xs:sequence>
    </xs:complexType>
    <!-- yearType-->
    <xs:complexType name="yearType">
        <xs:all>
            <xs:element name="days" type="daysType" minOccurs="0"/>
            <xs:element name="defaults" type="defaultsType" minOccurs="0"/>
            <xs:element name="properties" type="propertiesType" minOccurs="0"/>
        </xs:all>
        <xs:attribute name="year" type="xs:string"/>
    </xs:complexType>
    <!-- yearsType-->
    <xs:complexType name="yearsType">
        <xs:sequence>
            <xs:element name="year" type="yearType" minOccurs="0" maxOccurs="unbounded"/>
        </xs:sequence>
    </xs:complexType>
    <xs:complexType name="calendarType">
        <xs:all>
            <xs:element name="years" type="yearsType" minOccurs="0"/>
            <xs:element name="defaults" type="defaultsType" minOccurs="0"/>
            <xs:element name="properties" type="propertiesType" minOccurs="0"/>
        </xs:all>
        <xs:attribute name="timezone" type="xs:string"/>
    </xs:complexType>
    <!-- in-->
    <xs:element name="in">
        <xs:complexType>
            <xs:all>
                <xs:element name="request">
                    <xs:complexType>
                        <xs:attribute name="domain" type="xs:string" use="optional"/>
                    </xs:complexType>
                </xs:element>
            </xs:all>
        </xs:complexType>
    </xs:element>
    <!-- out-->
    <xs:element name="out">
        <xs:complexType>
            <xs:choice>
                <!--Positive case-->
                <xs:element name="calendar" type="calendarType"/>
            </xs:choice>
        </xs:complexType>
    </xs:element>
</xs:schema>


CODE

Пример

Запрос: http://192.168.1.21:9999/commands/domain_calendar_show

<?xml version="1.0" encoding="UTF-8"?>
<in xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="hc_domain_calendar_show.xsd">
    <request domain="biysk.local"/>
</in>
CODE

Ответ: 200

<?xml version="1.0"?>
<out
    xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="hc_domain_calendar_show.xsd">
    <calendar timezone="UTC+00:00">
        <years>
            <year year="2019">
                <days>
                    <day year="2019" month="1" day="2" type="HOLIDAY">
                        <properties/>
                    </day>
                    <day year="2019" month="3" day="8" type="HOLIDAY">
                        <properties/>
                    </day>
                </days>
                <defaults/>
                <properties/>
            </year>
            <year year="2020">
                <days>
                    <day year="2022" month="3" day="7" type="HALF-HOLIDAY">
                        <properties/>
                    </day>
                    <day year="2022" month="9" day="18" type="HALF-WORK">
                        <properties/>
                    </day>
                </days>
                <defaults/>
                <properties/>
            </year>
        </years>
        <defaults>
            <default>
                <mask year="*" month="*" day="*" day_of_week="6 7" day_of_year="*"/>
                <day date="*" type="DAY-OFF">
                    <properties/>
                </day>
            </default>
            <default>
                <mask year="*" month="5" day="9" day_of_week="*" day_of_year="*"/>
                <day date="*" type="HOLIDAY">
                    <properties/>
                </day>
            </default>
            <default>
                <mask year="*" month="1" day="*" day_of_week="*" day_of_year="8 9 10 11 12"/>
                <day date="*" type="WORK">
                    <properties/>
                </day>
            </default>
        </defaults>
        <properties>
            <property key="description" value="Default system calendar"/>
        </properties>
    </calendar>
</out>
CODE