POST | /eaccounting/invoice/{invoiceId}/email |
---|
<?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 SendAnInvoiceByEmail implements ICompany, JsonSerializable
{
public function __construct(
/** @var string|null */
public ?string $InvoiceId=null,
/** @var string|null */
public ?string $Email=null,
/** @var array<string>|null */
public ?array $CcRecipients=null,
/** @var string|null */
public ?string $Subject=null,
/** @var string|null */
public ?string $Message=null,
/** @var string|null */
public ?string $CompanyId=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['InvoiceId'])) $this->InvoiceId = $o['InvoiceId'];
if (isset($o['Email'])) $this->Email = $o['Email'];
if (isset($o['CcRecipients'])) $this->CcRecipients = JsonConverters::fromArray('string', $o['CcRecipients']);
if (isset($o['Subject'])) $this->Subject = $o['Subject'];
if (isset($o['Message'])) $this->Message = $o['Message'];
if (isset($o['CompanyId'])) $this->CompanyId = $o['CompanyId'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->InvoiceId)) $o['InvoiceId'] = $this->InvoiceId;
if (isset($this->Email)) $o['Email'] = $this->Email;
if (isset($this->CcRecipients)) $o['CcRecipients'] = JsonConverters::toArray('string', $this->CcRecipients);
if (isset($this->Subject)) $o['Subject'] = $this->Subject;
if (isset($this->Message)) $o['Message'] = $this->Message;
if (isset($this->CompanyId)) $o['CompanyId'] = $this->CompanyId;
return empty($o) ? new class(){} : $o;
}
}
To override the Content-type in your clients, use the HTTP Accept Header, append the .csv suffix or ?format=csv
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /eaccounting/invoice/{invoiceId}/email HTTP/1.1
Host: api.bokamera.se
Accept: text/csv
Content-Type: text/csv
Content-Length: length
{"InvoiceId":"String","Email":"String","CcRecipients":["String"],"Subject":"String","Message":"String","CompanyId":"00000000-0000-0000-0000-000000000000"}