All Verbs | /github/{UserName} |
---|
<?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 GetGithubRepos implements JsonSerializable
{
public function __construct(
/** @var string|null */
public ?string $userName=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['userName'])) $this->userName = $o['userName'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->userName)) $o['userName'] = $this->userName;
return empty($o) ? new class(){} : $o;
}
}
To override the Content-type in your clients, use the HTTP Accept Header, append the .xml suffix or ?format=xml
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /github/{UserName} HTTP/1.1
Host: sharpscript.net
Accept: application/xml
Content-Type: application/xml
Content-Length: length
<GetGithubRepos xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/SharpScript">
<UserName>String</UserName>
</GetGithubRepos>
HTTP/1.1 200 OK Content-Type: application/xml Content-Length: length <ArrayOfGithubRepo xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/SharpScript"> <GithubRepo> <Clone_Url>String</Clone_Url> <Created_at>0001-01-01T00:00:00</Created_at> <Description>String</Description> <Fork>false</Fork> <Forks_Count>0</Forks_Count> <Full_Name>String</Full_Name> <Git_Url>String</Git_Url> <Has_Downloads>false</Has_Downloads> <Has_Pages>false</Has_Pages> <Has_Wiki>false</Has_Wiki> <Has_issues>false</Has_issues> <Homepage>String</Homepage> <Html_Url>String</Html_Url> <Id>0</Id> <Language>String</Language> <Mirror_Url>String</Mirror_Url> <Name>String</Name> <Open_Issues_Count>0</Open_Issues_Count> <Owner> <Avatar_Url>String</Avatar_Url> <Bio>String</Bio> <Blog>String</Blog> <Company>String</Company> <Created_At>0001-01-01T00:00:00</Created_At> <Email>String</Email> <Followers>0</Followers> <Following>0</Following> <Gravatar_Id>String</Gravatar_Id> <Hireable>false</Hireable> <Html_Url>String</Html_Url> <Id>0</Id> <Location>String</Location> <Login>String</Login> <Name>String</Name> <Public_Gists>0</Public_Gists> <Public_Repos>0</Public_Repos> <Type>String</Type> <Url>String</Url> </Owner> <Private>false</Private> <Pushed_At>0001-01-01T00:00:00</Pushed_At> <Size>0</Size> <Ssh_Url>String</Ssh_Url> <Stargazes_Count>0</Stargazes_Count> <Svn_Url>String</Svn_Url> <Updated_At>0001-01-01T00:00:00</Updated_At> <Url>String</Url> <Watchers_Count>0</Watchers_Count> </GithubRepo> </ArrayOfGithubRepo>