mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-01-29 07:52:50 -05:00
core: replace all use of interface{} with any (#848)
This commit is contained in:
@@ -9,9 +9,9 @@ import (
|
||||
)
|
||||
|
||||
type Request struct {
|
||||
ID int `json:"id,omitempty"`
|
||||
Method string `json:"method"`
|
||||
Params map[string]interface{} `json:"params,omitempty"`
|
||||
ID int `json:"id,omitempty"`
|
||||
Method string `json:"method"`
|
||||
Params map[string]any `json:"params,omitempty"`
|
||||
}
|
||||
|
||||
type SuccessResult struct {
|
||||
|
||||
@@ -75,7 +75,7 @@ func TestHandleGetPrinters_Error(t *testing.T) {
|
||||
|
||||
handleGetPrinters(conn, req, m)
|
||||
|
||||
var resp models.Response[interface{}]
|
||||
var resp models.Response[any]
|
||||
err := json.NewDecoder(buf).Decode(&resp)
|
||||
assert.NoError(t, err)
|
||||
assert.Nil(t, resp.Result)
|
||||
@@ -103,7 +103,7 @@ func TestHandleGetJobs(t *testing.T) {
|
||||
req := Request{
|
||||
ID: 1,
|
||||
Method: "cups.getJobs",
|
||||
Params: map[string]interface{}{
|
||||
Params: map[string]any{
|
||||
"printerName": "printer1",
|
||||
},
|
||||
}
|
||||
@@ -130,12 +130,12 @@ func TestHandleGetJobs_MissingParam(t *testing.T) {
|
||||
req := Request{
|
||||
ID: 1,
|
||||
Method: "cups.getJobs",
|
||||
Params: map[string]interface{}{},
|
||||
Params: map[string]any{},
|
||||
}
|
||||
|
||||
handleGetJobs(conn, req, m)
|
||||
|
||||
var resp models.Response[interface{}]
|
||||
var resp models.Response[any]
|
||||
err := json.NewDecoder(buf).Decode(&resp)
|
||||
assert.NoError(t, err)
|
||||
assert.Nil(t, resp.Result)
|
||||
@@ -155,7 +155,7 @@ func TestHandlePausePrinter(t *testing.T) {
|
||||
req := Request{
|
||||
ID: 1,
|
||||
Method: "cups.pausePrinter",
|
||||
Params: map[string]interface{}{
|
||||
Params: map[string]any{
|
||||
"printerName": "printer1",
|
||||
},
|
||||
}
|
||||
@@ -182,7 +182,7 @@ func TestHandleResumePrinter(t *testing.T) {
|
||||
req := Request{
|
||||
ID: 1,
|
||||
Method: "cups.resumePrinter",
|
||||
Params: map[string]interface{}{
|
||||
Params: map[string]any{
|
||||
"printerName": "printer1",
|
||||
},
|
||||
}
|
||||
@@ -209,7 +209,7 @@ func TestHandleCancelJob(t *testing.T) {
|
||||
req := Request{
|
||||
ID: 1,
|
||||
Method: "cups.cancelJob",
|
||||
Params: map[string]interface{}{
|
||||
Params: map[string]any{
|
||||
"jobID": float64(1),
|
||||
},
|
||||
}
|
||||
@@ -236,7 +236,7 @@ func TestHandlePurgeJobs(t *testing.T) {
|
||||
req := Request{
|
||||
ID: 1,
|
||||
Method: "cups.purgeJobs",
|
||||
Params: map[string]interface{}{
|
||||
Params: map[string]any{
|
||||
"printerName": "printer1",
|
||||
},
|
||||
}
|
||||
@@ -267,7 +267,7 @@ func TestHandleRequest_UnknownMethod(t *testing.T) {
|
||||
|
||||
HandleRequest(conn, req, m)
|
||||
|
||||
var resp models.Response[interface{}]
|
||||
var resp models.Response[any]
|
||||
err := json.NewDecoder(buf).Decode(&resp)
|
||||
assert.NoError(t, err)
|
||||
assert.Nil(t, resp.Result)
|
||||
|
||||
@@ -62,7 +62,7 @@ func (sm *SubscriptionManager) createSubscription() (int, error) {
|
||||
req.OperationAttributes[ipp.AttributeRequestingUserName] = "dms"
|
||||
|
||||
// Subscription attributes go in SubscriptionAttributes (subscription-attributes-tag in IPP)
|
||||
req.SubscriptionAttributes = map[string]interface{}{
|
||||
req.SubscriptionAttributes = map[string]any{
|
||||
"notify-events": []string{
|
||||
"printer-state-changed",
|
||||
"printer-added",
|
||||
|
||||
@@ -83,7 +83,7 @@ func (sm *DBusSubscriptionManager) createDBusSubscription() (int, error) {
|
||||
req.OperationAttributes[ipp.AttributePrinterURI] = fmt.Sprintf("%s/", sm.baseURL)
|
||||
req.OperationAttributes[ipp.AttributeRequestingUserName] = "dms"
|
||||
|
||||
req.SubscriptionAttributes = map[string]interface{}{
|
||||
req.SubscriptionAttributes = map[string]any{
|
||||
"notify-events": []string{
|
||||
"printer-state-changed",
|
||||
"printer-added",
|
||||
|
||||
Reference in New Issue
Block a user