#Script Pages

<back to all web services

QueryGitHubRepos

Imports System
Imports System.Collections
Imports System.Collections.Generic
Imports System.Runtime.Serialization
Imports ServiceStack
Imports ServiceStack.DataAnnotations
Imports SharpScript

Namespace Global

    Namespace ServiceStack

        <DataContract>
        Public Partial Class QueryBase
            Public Sub New()
                Meta = New Dictionary(Of String, String)
            End Sub

            <DataMember(Order:=1)>
            Public Overridable Property Skip As Nullable(Of Integer)

            <DataMember(Order:=2)>
            Public Overridable Property Take As Nullable(Of Integer)

            <DataMember(Order:=3)>
            Public Overridable Property OrderBy As String

            <DataMember(Order:=4)>
            Public Overridable Property OrderByDesc As String

            <DataMember(Order:=5)>
            Public Overridable Property Include As String

            <DataMember(Order:=6)>
            Public Overridable Property Fields As String

            <DataMember(Order:=7)>
            Public Overridable Property Meta As Dictionary(Of String, String)
        End Class

        Public Partial Class QueryData(Of T)
            Inherits QueryBase
        End Class

        <DataContract>
        Public Partial Class QueryResponse(Of Customer)
            Public Sub New()
                Results = New List(Of Customer)
                Meta = New Dictionary(Of String, String)
            End Sub

            <DataMember(Order:=1)>
            Public Overridable Property Offset As Integer

            <DataMember(Order:=2)>
            Public Overridable Property Total As Integer

            <DataMember(Order:=3)>
            Public Overridable Property Results As List(Of Customer)

            <DataMember(Order:=4)>
            Public Overridable Property Meta As Dictionary(Of String, String)

            <DataMember(Order:=5)>
            Public Overridable Property ResponseStatus As ResponseStatus
        End Class
    End Namespace

    Namespace SharpScript

        Public Partial Class Customer
            Public Sub New()
                Orders = New List(Of Order)
            End Sub

            Public Overridable Property CustomerId As String
            Public Overridable Property CompanyName As String
            Public Overridable Property Address As String
            Public Overridable Property City As String
            Public Overridable Property Region As String
            Public Overridable Property PostalCode As String
            Public Overridable Property Country As String
            Public Overridable Property Phone As String
            Public Overridable Property Fax As String
            Public Overridable Property Orders As List(Of Order)
        End Class

        Public Partial Class GithubRepo
            Public Overridable Property Id As Integer
            Public Overridable Property Name As String
            Public Overridable Property Description As String
            Public Overridable Property Homepage As String
            Public Overridable Property Language As String
            Public Overridable Property Watchers_Count As Integer
            Public Overridable Property Stargazes_Count As Integer
            Public Overridable Property Forks_Count As Integer
            Public Overridable Property Open_Issues_Count As Integer
            Public Overridable Property Size As Integer
            Public Overridable Property Full_Name As String
            Public Overridable Property Created_at As Date
            Public Overridable Property Pushed_At As Nullable(Of Date)
            Public Overridable Property Updated_At As Nullable(Of Date)
            Public Overridable Property Has_issues As Boolean
            Public Overridable Property Has_Downloads As Boolean
            Public Overridable Property Has_Wiki As Boolean
            Public Overridable Property Has_Pages As Boolean
            Public Overridable Property Fork As Boolean
            Public Overridable Property Owner As GithubUser
            Public Overridable Property Svn_Url As String
            Public Overridable Property Mirror_Url As String
            Public Overridable Property Url As String
            Public Overridable Property Ssh_Url As String
            Public Overridable Property Html_Url As String
            Public Overridable Property Clone_Url As String
            Public Overridable Property Git_Url As String
            Public Overridable Property Private As Boolean
        End Class

        Public Partial Class GithubUser
            Public Overridable Property Id As Integer
            Public Overridable Property Login As String
            Public Overridable Property Avatar_Url As String
            Public Overridable Property Url As String
            Public Overridable Property Followers As Nullable(Of Integer)
            Public Overridable Property Following As Nullable(Of Integer)
            Public Overridable Property Type As String
            Public Overridable Property Public_Gists As Nullable(Of Integer)
            Public Overridable Property Location As String
            Public Overridable Property Company As String
            Public Overridable Property Html_Url As String
            Public Overridable Property Public_Repos As Nullable(Of Integer)
            Public Overridable Property Created_At As Nullable(Of Date)
            Public Overridable Property Blog As String
            Public Overridable Property Email As String
            Public Overridable Property Name As String
            Public Overridable Property Hireable As Nullable(Of Boolean)
            Public Overridable Property Gravatar_Id As String
            Public Overridable Property Bio As String
        End Class

        Public Partial Class Order
            Public Overridable Property OrderId As Integer
            Public Overridable Property CustomerId As String
            Public Overridable Property OrderDate As Date
            Public Overridable Property Total As Double
        End Class

        Public Partial Class QueryGitHubRepos
            Inherits QueryData(Of GithubRepo)
            Public Overridable Property UserName As String
        End Class
    End Namespace
End Namespace

VB.NET QueryGitHubRepos 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 /csv/reply/QueryGitHubRepos HTTP/1.1 
Host: sharpscript.net 
Accept: text/csv
Content-Type: text/csv
Content-Length: length

{"userName":"String","skip":0,"take":0,"orderBy":"String","orderByDesc":"String","include":"String","fields":"String","meta":{"String":"String"}}
HTTP/1.1 200 OK
Content-Type: text/csv
Content-Length: length

{"offset":0,"total":0,"results":[{"id":0,"name":"String","description":"String","homepage":"String","language":"String","watchers_Count":0,"stargazes_Count":0,"forks_Count":0,"open_Issues_Count":0,"size":0,"full_Name":"String","created_at":"\/Date(-62135596800000-0000)\/","pushed_At":"\/Date(-62135596800000-0000)\/","updated_At":"\/Date(-62135596800000-0000)\/","has_issues":false,"has_Downloads":false,"has_Wiki":false,"has_Pages":false,"fork":false,"owner":{"id":0,"login":"String","avatar_Url":"String","url":"String","followers":0,"following":0,"type":"String","public_Gists":0,"location":"String","company":"String","html_Url":"String","public_Repos":0,"created_At":"\/Date(-62135596800000-0000)\/","blog":"String","email":"String","name":"String","hireable":false,"gravatar_Id":"String","bio":"String"},"svn_Url":"String","mirror_Url":"String","url":"String","ssh_Url":"String","html_Url":"String","clone_Url":"String","git_Url":"String","private":false}],"meta":{"String":"String"},"responseStatus":{"errorCode":"String","message":"String","stackTrace":"String","errors":[{"errorCode":"String","fieldName":"String","message":"String","meta":{"String":"String"}}],"meta":{"String":"String"}}}