FrameAppWS

<back to all web services

GuardarDatosFormaRQ

Requires Authentication
The following routes are available for this service:
All Verbs/Utilidades/Formas/GuardarDatos
<?php namespace dtos;

use DateTime;
use Exception;
use DateInterval;
use JsonSerializable;
use ServiceStack\{IReturn,IReturnVoid,IGet,IPost,IPut,IDelete,IPatch,IMeta,IHasSessionId,IHasBearerToken,IHasVersion};
use ServiceStack\{ICrud,ICreateDb,IUpdateDb,IPatchDb,IDeleteDb,ISaveDb,AuditBase,QueryDb,QueryDb2,QueryData,QueryData2,QueryResponse};
use ServiceStack\{ResponseStatus,ResponseError,EmptyResponse,IdResponse,ArrayList,KeyValuePair2,StringResponse,StringsResponse,Tuple2,Tuple3,ByteArray};
use ServiceStack\{JsonConverters,Returns,TypeContext};


class NovedadesCarga implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $Fila=0,
        /** @var int */
        public int $Columna=0,
        /** @var string|null */
        public ?string $TipoError=null,
        /** @var string|null */
        public ?string $Novedad=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['Fila'])) $this->Fila = $o['Fila'];
        if (isset($o['Columna'])) $this->Columna = $o['Columna'];
        if (isset($o['TipoError'])) $this->TipoError = $o['TipoError'];
        if (isset($o['Novedad'])) $this->Novedad = $o['Novedad'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->Fila)) $o['Fila'] = $this->Fila;
        if (isset($this->Columna)) $o['Columna'] = $this->Columna;
        if (isset($this->TipoError)) $o['TipoError'] = $this->TipoError;
        if (isset($this->Novedad)) $o['Novedad'] = $this->Novedad;
        return empty($o) ? new class(){} : $o;
    }
}

class GuardarDatosFormaDetalleRS implements JsonSerializable
{
    public function __construct(
        /** @var float */
        public float $IDDetalle=0.0,
        /** @var array<NovedadesCarga>|null */
        public ?array $Novedades=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['IDDetalle'])) $this->IDDetalle = $o['IDDetalle'];
        if (isset($o['Novedades'])) $this->Novedades = JsonConverters::fromArray('NovedadesCarga', $o['Novedades']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->IDDetalle)) $o['IDDetalle'] = $this->IDDetalle;
        if (isset($this->Novedades)) $o['Novedades'] = JsonConverters::toArray('NovedadesCarga', $this->Novedades);
        return empty($o) ? new class(){} : $o;
    }
}

class GeneralRS implements JsonSerializable
{
    public function __construct(
        /** @description Id del código de respuesta 1: Correcto, -1: Error */
        // @ApiMember(DataType="int", Description="Id del código de respuesta 1: Correcto, -1: Error", IsRequired=true, ParameterType="body")
        /** @var int */
        public int $Codigo=0,

        /** @description Mensaje que se envía al ejecutar el servicio */
        // @ApiMember(DataType="string", Description="Mensaje que se envía al ejecutar el servicio", IsRequired=true, ParameterType="body")
        /** @var string */
        public string $Mensaje=''
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['Codigo'])) $this->Codigo = $o['Codigo'];
        if (isset($o['Mensaje'])) $this->Mensaje = $o['Mensaje'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->Codigo)) $o['Codigo'] = $this->Codigo;
        if (isset($this->Mensaje)) $o['Mensaje'] = $this->Mensaje;
        return empty($o) ? new class(){} : $o;
    }
}

class ExecuteDBFunctionRS extends GeneralRS implements JsonSerializable
{
    /**
     * @param int $Codigo
     * @param string $Mensaje
     */
    public function __construct(
        int $Codigo=0,
        string $Mensaje='',
        /** @var Object|null */
        public ?Object $Respuesta=null,
        /** @var float */
        public float $IDEjecucion=0.0,
        /** @var string|null */
        public ?string $URLArchivo=null,
        /** @var string|null */
        public ?string $TipoRespuesta=null,
        /** @var bool|null */
        public ?bool $Background=null,
        /** @var int */
        public int $TiempoRespuestaBD=0,
        /** @var int */
        public int $TiempoRespuestaTotal=0
    ) {
        parent::__construct($Codigo,$Mensaje);
    }

    /** @throws Exception */
    public function fromMap($o): void {
        parent::fromMap($o);
        if (isset($o['Respuesta'])) $this->Respuesta = JsonConverters::from('Object', $o['Respuesta']);
        if (isset($o['IDEjecucion'])) $this->IDEjecucion = $o['IDEjecucion'];
        if (isset($o['URLArchivo'])) $this->URLArchivo = $o['URLArchivo'];
        if (isset($o['TipoRespuesta'])) $this->TipoRespuesta = $o['TipoRespuesta'];
        if (isset($o['Background'])) $this->Background = $o['Background'];
        if (isset($o['TiempoRespuestaBD'])) $this->TiempoRespuestaBD = $o['TiempoRespuestaBD'];
        if (isset($o['TiempoRespuestaTotal'])) $this->TiempoRespuestaTotal = $o['TiempoRespuestaTotal'];
        if (isset($o['Codigo'])) $this->Codigo = $o['Codigo'];
        if (isset($o['Mensaje'])) $this->Mensaje = $o['Mensaje'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = parent::jsonSerialize();
        if (isset($this->Respuesta)) $o['Respuesta'] = JsonConverters::to('Object', $this->Respuesta);
        if (isset($this->IDEjecucion)) $o['IDEjecucion'] = $this->IDEjecucion;
        if (isset($this->URLArchivo)) $o['URLArchivo'] = $this->URLArchivo;
        if (isset($this->TipoRespuesta)) $o['TipoRespuesta'] = $this->TipoRespuesta;
        if (isset($this->Background)) $o['Background'] = $this->Background;
        if (isset($this->TiempoRespuestaBD)) $o['TiempoRespuestaBD'] = $this->TiempoRespuestaBD;
        if (isset($this->TiempoRespuestaTotal)) $o['TiempoRespuestaTotal'] = $this->TiempoRespuestaTotal;
        if (isset($this->Codigo)) $o['Codigo'] = $this->Codigo;
        if (isset($this->Mensaje)) $o['Mensaje'] = $this->Mensaje;
        return empty($o) ? new class(){} : $o;
    }
}

class GuardarDatosFormaRS implements JsonSerializable
{
    public function __construct(
        /** @var bool|null */
        public ?bool $Success=null,
        /** @var string|null */
        public ?string $Error=null,
        /** @var array<string,Object>|null */
        public ?array $DatosLlaveMaestro=null,
        /** @var array<GuardarDatosFormaDetalleRS>|null */
        public ?array $NovedadesDetalles=null,
        /** @var ExecuteDBFunctionRS|null */
        public ?ExecuteDBFunctionRS $RespuestaProcAlmacenado=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['Success'])) $this->Success = $o['Success'];
        if (isset($o['Error'])) $this->Error = $o['Error'];
        if (isset($o['DatosLlaveMaestro'])) $this->DatosLlaveMaestro = JsonConverters::from(JsonConverters::context('Dictionary',genericArgs:['string','Object']), $o['DatosLlaveMaestro']);
        if (isset($o['NovedadesDetalles'])) $this->NovedadesDetalles = JsonConverters::fromArray('GuardarDatosFormaDetalleRS', $o['NovedadesDetalles']);
        if (isset($o['RespuestaProcAlmacenado'])) $this->RespuestaProcAlmacenado = JsonConverters::from('ExecuteDBFunctionRS', $o['RespuestaProcAlmacenado']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->Success)) $o['Success'] = $this->Success;
        if (isset($this->Error)) $o['Error'] = $this->Error;
        if (isset($this->DatosLlaveMaestro)) $o['DatosLlaveMaestro'] = JsonConverters::to(JsonConverters::context('Dictionary',genericArgs:['string','Object']), $this->DatosLlaveMaestro);
        if (isset($this->NovedadesDetalles)) $o['NovedadesDetalles'] = JsonConverters::toArray('GuardarDatosFormaDetalleRS', $this->NovedadesDetalles);
        if (isset($this->RespuestaProcAlmacenado)) $o['RespuestaProcAlmacenado'] = JsonConverters::to('ExecuteDBFunctionRS', $this->RespuestaProcAlmacenado);
        return empty($o) ? new class(){} : $o;
    }
}

enum OperacionDatos : string
{
    case INSERT = 'INSERT';
    case UPDATE = 'UPDATE';
    case DELETE = 'DELETE';
}

class GuardarDatosDetalle implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $IDDetalle=0,
        /** @var array<array<string,Object>>|null */
        public ?array $DatosInsert=null,
        /** @var array<array<string,Object>>|null */
        public ?array $DatosUpdate=null,
        /** @var array<array<string,Object>>|null */
        public ?array $DatosDelete=null,
        /** @var string|null */
        public ?string $NombreArchivo=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['IDDetalle'])) $this->IDDetalle = $o['IDDetalle'];
        if (isset($o['DatosInsert'])) $this->DatosInsert = JsonConverters::fromArray('Dictionary<String,Object>', $o['DatosInsert']);
        if (isset($o['DatosUpdate'])) $this->DatosUpdate = JsonConverters::fromArray('Dictionary<String,Object>', $o['DatosUpdate']);
        if (isset($o['DatosDelete'])) $this->DatosDelete = JsonConverters::fromArray('Dictionary<String,Object>', $o['DatosDelete']);
        if (isset($o['NombreArchivo'])) $this->NombreArchivo = $o['NombreArchivo'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->IDDetalle)) $o['IDDetalle'] = $this->IDDetalle;
        if (isset($this->DatosInsert)) $o['DatosInsert'] = JsonConverters::toArray('Dictionary<String,Object>', $this->DatosInsert);
        if (isset($this->DatosUpdate)) $o['DatosUpdate'] = JsonConverters::toArray('Dictionary<String,Object>', $this->DatosUpdate);
        if (isset($this->DatosDelete)) $o['DatosDelete'] = JsonConverters::toArray('Dictionary<String,Object>', $this->DatosDelete);
        if (isset($this->NombreArchivo)) $o['NombreArchivo'] = $this->NombreArchivo;
        return empty($o) ? new class(){} : $o;
    }
}

class GuardarDatosFormaRQ implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $IDForma=0,
        /** @var OperacionDatos|null */
        public ?OperacionDatos $Operacion=null,
        /** @var array<string,Object>|null */
        public ?array $DatosMaestro=null,
        /** @var array<GuardarDatosDetalle>|null */
        public ?array $DatosDetalle=null,
        /** @var array<GuardarDatosFormaRQ>|null */
        public ?array $FormasDep=null,
        /** @var string|null */
        public ?string $TokenCargaArchivos=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['IDForma'])) $this->IDForma = $o['IDForma'];
        if (isset($o['Operacion'])) $this->Operacion = JsonConverters::from('OperacionDatos', $o['Operacion']);
        if (isset($o['DatosMaestro'])) $this->DatosMaestro = JsonConverters::from(JsonConverters::context('Dictionary',genericArgs:['string','Object']), $o['DatosMaestro']);
        if (isset($o['DatosDetalle'])) $this->DatosDetalle = JsonConverters::fromArray('GuardarDatosDetalle', $o['DatosDetalle']);
        if (isset($o['FormasDep'])) $this->FormasDep = JsonConverters::fromArray('GuardarDatosFormaRQ', $o['FormasDep']);
        if (isset($o['TokenCargaArchivos'])) $this->TokenCargaArchivos = $o['TokenCargaArchivos'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->IDForma)) $o['IDForma'] = $this->IDForma;
        if (isset($this->Operacion)) $o['Operacion'] = JsonConverters::to('OperacionDatos', $this->Operacion);
        if (isset($this->DatosMaestro)) $o['DatosMaestro'] = JsonConverters::to(JsonConverters::context('Dictionary',genericArgs:['string','Object']), $this->DatosMaestro);
        if (isset($this->DatosDetalle)) $o['DatosDetalle'] = JsonConverters::toArray('GuardarDatosDetalle', $this->DatosDetalle);
        if (isset($this->FormasDep)) $o['FormasDep'] = JsonConverters::toArray('GuardarDatosFormaRQ', $this->FormasDep);
        if (isset($this->TokenCargaArchivos)) $o['TokenCargaArchivos'] = $this->TokenCargaArchivos;
        return empty($o) ? new class(){} : $o;
    }
}

PHP GuardarDatosFormaRQ DTOs

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

HTTP + CSV

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

POST /Utilidades/Formas/GuardarDatos HTTP/1.1 
Host: soluser-recaudo.sgsas.co 
Accept: text/csv
Content-Type: text/csv
Content-Length: length

{"IDForma":0,"Operacion":"INSERT","DatosMaestro":{"String":{}},"DatosDetalle":[{"IDDetalle":0,"DatosInsert":[{"String":{}}],"DatosUpdate":[{"String":{}}],"DatosDelete":[{"String":{}}],"NombreArchivo":"String"}],"FormasDep":[{"IDForma":0,"Operacion":"INSERT","DatosMaestro":{"String":{}},"DatosDetalle":[{"IDDetalle":0,"DatosInsert":[{"String":{}}],"DatosUpdate":[{"String":{}}],"DatosDelete":[{"String":{}}],"NombreArchivo":"String"}],"FormasDep":[{"IDForma":0,"Operacion":"INSERT","DatosMaestro":{"String":{}},"DatosDetalle":[{"IDDetalle":0,"DatosInsert":[{"String":{}}],"DatosUpdate":[{"String":{}}],"DatosDelete":[{"String":{}}],"NombreArchivo":"String"}],"FormasDep":[{"IDForma":0,"Operacion":"INSERT","DatosMaestro":{"String":{}},"DatosDetalle":[{"IDDetalle":0,"DatosInsert":[{"String":{}}],"DatosUpdate":[{"String":{}}],"DatosDelete":[{"String":{}}],"NombreArchivo":"String"}],"FormasDep":null,"TokenCargaArchivos":"String"}],"TokenCargaArchivos":"String"}],"TokenCargaArchivos":"String"}],"TokenCargaArchivos":"String"}
HTTP/1.1 200 OK
Content-Type: text/csv
Content-Length: length

{"Success":false,"Error":"String","DatosLlaveMaestro":{"String":{}},"NovedadesDetalles":[{"IDDetalle":0,"Novedades":[{"Fila":0,"Columna":0,"TipoError":"String","Novedad":"String"}]}],"RespuestaProcAlmacenado":{"Respuesta":{},"IDEjecucion":0,"URLArchivo":"String","TipoRespuesta":"String","Background":false,"TiempoRespuestaBD":0,"TiempoRespuestaTotal":0,"Codigo":0,"Mensaje":"String"}}