Unico3.Link.API

<back to all web services

Comune

Base
The following routes are available for this service:
PUT/tabelle/comuni/
PUT,GET/tabelle/comuni/{Id}
PUT,GET/tabelle/comuni/codiceexport/{CodiceExport}
import 'package:servicestack/servicestack.dart';

abstract class FK
{
    int? Id;

    FK({this.Id});
    FK.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        Id = json['Id'];
        return this;
    }

    Map<String, dynamic> toJson() => {
        'Id': Id
    };

    getTypeName() => "FK";
    TypeContext? context = _ctx;
}

class FK_Zona extends FK implements IUniqueSigla, IUniqueDescrizione, IConvertible
{
    String? Sigla;
    String? Descrizione;

    FK_Zona({this.Sigla,this.Descrizione});
    FK_Zona.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        super.fromMap(json);
        Sigla = json['Sigla'];
        Descrizione = json['Descrizione'];
        return this;
    }

    Map<String, dynamic> toJson() => super.toJson()..addAll({
        'Sigla': Sigla,
        'Descrizione': Descrizione
    });

    getTypeName() => "FK_Zona";
    TypeContext? context = _ctx;
}

class OptionalNullableDouble extends Optional<double> implements IConvertible
{
    OptionalNullableDouble();
    OptionalNullableDouble.fromJson(Map<String, dynamic> json) : super.fromJson(json);
    fromMap(Map<String, dynamic> json) {
        super.fromMap(json);
        return this;
    }

    Map<String, dynamic> toJson() => super.toJson();
    getTypeName() => "OptionalNullableDouble";
    TypeContext? context = _ctx;
}

class OptionalNullableInteger extends Optional<int> implements IConvertible
{
    OptionalNullableInteger();
    OptionalNullableInteger.fromJson(Map<String, dynamic> json) : super.fromJson(json);
    fromMap(Map<String, dynamic> json) {
        super.fromMap(json);
        return this;
    }

    Map<String, dynamic> toJson() => super.toJson();
    getTypeName() => "OptionalNullableInteger";
    TypeContext? context = _ctx;
}

class Comune implements IConvertible
{
    String? CodiceExport;
    int? Id;
    String? Denominazione;
    String? CAP;
    String? Provincia;
    FK_Zona? Zona;
    bool? IsEsclusoDaListe;
    String? CodiceISTAT;
    OptionalNullableDouble? DurezzaTotaleAcqua;
    OptionalNullableInteger? TipoRCEE;

    Comune({this.CodiceExport,this.Id,this.Denominazione,this.CAP,this.Provincia,this.Zona,this.IsEsclusoDaListe,this.CodiceISTAT,this.DurezzaTotaleAcqua,this.TipoRCEE});
    Comune.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        CodiceExport = json['CodiceExport'];
        Id = json['Id'];
        Denominazione = json['Denominazione'];
        CAP = json['CAP'];
        Provincia = json['Provincia'];
        Zona = JsonConverters.fromJson(json['Zona'],'FK_Zona',context!);
        IsEsclusoDaListe = json['IsEsclusoDaListe'];
        CodiceISTAT = json['CodiceISTAT'];
        DurezzaTotaleAcqua = JsonConverters.fromJson(json['DurezzaTotaleAcqua'],'OptionalNullableDouble',context!);
        TipoRCEE = JsonConverters.fromJson(json['TipoRCEE'],'OptionalNullableInteger',context!);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'CodiceExport': CodiceExport,
        'Id': Id,
        'Denominazione': Denominazione,
        'CAP': CAP,
        'Provincia': Provincia,
        'Zona': JsonConverters.toJson(Zona,'FK_Zona',context!),
        'IsEsclusoDaListe': IsEsclusoDaListe,
        'CodiceISTAT': CodiceISTAT,
        'DurezzaTotaleAcqua': JsonConverters.toJson(DurezzaTotaleAcqua,'OptionalNullableDouble',context!),
        'TipoRCEE': JsonConverters.toJson(TipoRCEE,'OptionalNullableInteger',context!)
    };

    getTypeName() => "Comune";
    TypeContext? context = _ctx;
}

class Optional<T> implements IConvertible
{
    String? Value;

    Optional({this.Value});
    Optional.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        Value = JsonConverters.fromJson(json['Value'],'Nullable<${runtimeGenericTypeDefs(this,[0]).join(",")}>',context!);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'Value': JsonConverters.toJson(Value,'String',context!)
    };

    getTypeName() => "Optional<$T>";
    TypeContext? context = _ctx;
}

TypeContext _ctx = TypeContext(library: 'link.dc8.unico3.cloud', types: <String, TypeInfo> {
    'FK': TypeInfo(TypeOf.AbstractClass),
    'FK_Zona': TypeInfo(TypeOf.Class, create:() => FK_Zona()),
    'OptionalNullableDouble': TypeInfo(TypeOf.Class, create:() => OptionalNullableDouble()),
    'OptionalNullableInteger': TypeInfo(TypeOf.Class, create:() => OptionalNullableInteger()),
    'Comune': TypeInfo(TypeOf.Class, create:() => Comune()),
    'Optional<T>': TypeInfo(TypeOf.GenericDef,create:() => Optional()),
});

Dart Comune DTOs

To override the Content-type in your clients, use the HTTP Accept Header, append the .json suffix or ?format=json

To embed the response in a jsonp callback, append ?callback=myCallback

HTTP + JSON

The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.

PUT /tabelle/comuni/ HTTP/1.1 
Host: unico3.link.api 
Accept: application/json
Content-Type: application/json
Content-Length: length

{"CodiceExport":"String","Id":0,"Denominazione":"String","CAP":"String","Provincia":"String","Zona":{"Sigla":"String","Descrizione":"String","Id":0},"IsEsclusoDaListe":false,"CodiceISTAT":"String","DurezzaTotaleAcqua":{"Value":0},"TipoRCEE":{"Value":0}}
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: length

{"CodiceExport":"String","Id":0,"Denominazione":"String","CAP":"String","Provincia":"String","Zona":{"Sigla":"String","Descrizione":"String","Id":0},"IsEsclusoDaListe":false,"CodiceISTAT":"String","DurezzaTotaleAcqua":{"Value":0},"TipoRCEE":{"Value":0}}