mirror of
https://wiilab.wiimart.org/wiimart/WiiSOAP
synced 2025-09-05 21:11:02 +02:00
Add test ListItems response
Not currently functional, but parses succesfully.
This commit is contained in:
parent
50bf68ed8b
commit
8291cff180
41
cas.go
Normal file
41
cas.go
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
func listItems(e *Envelope) {
|
||||||
|
titleId, err := getKey(e.doc, "TitleId")
|
||||||
|
if err != nil {
|
||||||
|
e.Error(9, "Unable to obtain title.", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
e.AddKVNode("ListResultTotalSize", "1")
|
||||||
|
e.AddCustomType(Items{
|
||||||
|
TitleId: titleId,
|
||||||
|
Contents: ContentsMetadata{
|
||||||
|
TitleIncluded: false,
|
||||||
|
ContentIndex: 1,
|
||||||
|
},
|
||||||
|
Attributes: []Attributes{
|
||||||
|
{
|
||||||
|
Name: "MaxUserInodes",
|
||||||
|
Value: "10",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Name: "itemComment",
|
||||||
|
Value: "Does not catch on fire.",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
Ratings: Ratings{
|
||||||
|
Name: "Testing",
|
||||||
|
Rating: 1,
|
||||||
|
Age: 13,
|
||||||
|
},
|
||||||
|
Prices: Prices{
|
||||||
|
ItemId: 0,
|
||||||
|
Price: Price{
|
||||||
|
Amount: 1,
|
||||||
|
Currency: "POINTS",
|
||||||
|
},
|
||||||
|
Limits: LimitStruct(PR),
|
||||||
|
LicenseKind: "PERMANENT",
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
5
main.go
5
main.go
@ -96,6 +96,11 @@ func main() {
|
|||||||
ias.Unauthenticated("Register", register)
|
ias.Unauthenticated("Register", register)
|
||||||
ias.Authenticated("Unregister", unregister)
|
ias.Authenticated("Unregister", unregister)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cas := r.HandleGroup("cas")
|
||||||
|
{
|
||||||
|
cas.Authenticated("ListItems", listItems)
|
||||||
|
}
|
||||||
log.Fatal(http.ListenAndServe(readConfig.Address, r.Handle()))
|
log.Fatal(http.ListenAndServe(readConfig.Address, r.Handle()))
|
||||||
|
|
||||||
// From here on out, all special cool things should go into their respective handler function.
|
// From here on out, all special cool things should go into their respective handler function.
|
||||||
|
47
structure.go
47
structure.go
@ -163,3 +163,50 @@ type Tickets struct {
|
|||||||
MigrateCount int `xml:"MigrateCount"`
|
MigrateCount int `xml:"MigrateCount"`
|
||||||
MigrateLimit int `xml:"MigrateLimit"`
|
MigrateLimit int `xml:"MigrateLimit"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Attributes represents a common structure of the same name.
|
||||||
|
type Attributes struct {
|
||||||
|
XMLName xml.Name `xml:"Attributes"`
|
||||||
|
Name string `xml:"Name"`
|
||||||
|
Value string `xml:"Value"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// ContentsMetadata describes data about contents within a title.
|
||||||
|
type ContentsMetadata struct {
|
||||||
|
XMLName xml.Name `xml:"Contents"`
|
||||||
|
TitleIncluded bool `xml:"TitleIncluded"`
|
||||||
|
ContentIndex int `xml:"ContentIndex"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Price holds the price for a title.
|
||||||
|
type Price struct {
|
||||||
|
XMLName xml.Name `xml:"Price"`
|
||||||
|
Amount int `xml:"Amount"`
|
||||||
|
Currency string `xml:"Currency"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Prices describes a common structure for listing prices within a title.
|
||||||
|
type Prices struct {
|
||||||
|
ItemId int `xml:"ItemId"`
|
||||||
|
Price Price
|
||||||
|
Limits Limits `xml:"Limits"`
|
||||||
|
LicenseKind string `xml:"LicenseKind"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Items allows specifying an overview of a title's contents.
|
||||||
|
type Items struct {
|
||||||
|
XMLName xml.Name `xml:"Items"`
|
||||||
|
TitleId string `xml:"TitleId"`
|
||||||
|
Contents ContentsMetadata `xml:"Contents"`
|
||||||
|
Attributes []Attributes `xml:"Attribute,omitempty"`
|
||||||
|
Ratings Ratings `xml:"Ratings,omitempty"`
|
||||||
|
Prices Prices `xml:"Prices,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Ratings allows specifying the rating of an item across multiple properties.
|
||||||
|
type Ratings struct {
|
||||||
|
XMLName xml.Name `xml:"Ratings"`
|
||||||
|
Name string `xml:"Name"`
|
||||||
|
Rating int `xml:"Rating"`
|
||||||
|
Age int `xml:"Age"`
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user