mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-04-15 21:07:38 -04:00
* make the JMAP internal API a bit more future-proof by passing ObjectType objects instead of the JMAP namespaces * remove the new attempt to contain operations even further using the Factory objects * move CalendarEvent operations to its own file, like everything else * fix email tests * ignore WS error when closing an already closed connection
88 lines
2.5 KiB
Go
88 lines
2.5 KiB
Go
package jmap
|
|
|
|
var NS_QUOTA = ns(JmapQuota)
|
|
|
|
func (j *Client) GetQuotas(accountIds []string, ctx Context) (map[string]QuotaGetResponse, SessionState, State, Language, Error) {
|
|
return getN(j, "GetQuotas", QuotaType,
|
|
func(accountId string, ids []string) QuotaGetCommand {
|
|
return QuotaGetCommand{AccountId: accountId}
|
|
},
|
|
QuotaGetResponse{},
|
|
identity1,
|
|
identity1,
|
|
accountIds, []string{},
|
|
ctx,
|
|
)
|
|
}
|
|
|
|
type QuotaChanges = ChangesTemplate[Quota]
|
|
|
|
// Retrieve the changes in Quotas since a given State.
|
|
// @api:tags quota,changes
|
|
func (j *Client) GetQuotaChanges(accountId string, sinceState State, maxChanges uint,
|
|
ctx Context) (QuotaChanges, SessionState, State, Language, Error) {
|
|
return changesA(j, "GetQuotaChanges", QuotaType,
|
|
func() QuotaChangesCommand {
|
|
return QuotaChangesCommand{AccountId: accountId, SinceState: sinceState, MaxChanges: uintPtr(maxChanges)}
|
|
},
|
|
QuotaChangesResponse{},
|
|
QuotaGetResponse{},
|
|
func(path string, rof string) QuotaGetRefCommand {
|
|
return QuotaGetRefCommand{
|
|
AccountId: accountId,
|
|
IdsRef: &ResultReference{
|
|
Name: CommandQuotaChanges,
|
|
Path: path,
|
|
ResultOf: rof,
|
|
},
|
|
}
|
|
},
|
|
func(oldState, newState State, hasMoreChanges bool, created, updated []Quota, destroyed []string) QuotaChanges {
|
|
return QuotaChanges{
|
|
OldState: oldState,
|
|
NewState: newState,
|
|
HasMoreChanges: hasMoreChanges,
|
|
Created: created,
|
|
Updated: updated,
|
|
Destroyed: destroyed,
|
|
}
|
|
},
|
|
ctx,
|
|
)
|
|
}
|
|
|
|
func (j *Client) GetQuotaUsageChanges(accountId string, sinceState State, maxChanges uint,
|
|
ctx Context) (QuotaChanges, SessionState, State, Language, Error) {
|
|
return updates(j, "GetQuotaUsageChanges", QuotaType,
|
|
func() QuotaChangesCommand {
|
|
return QuotaChangesCommand{AccountId: accountId, SinceState: sinceState, MaxChanges: uintPtr(maxChanges)}
|
|
},
|
|
QuotaChangesResponse{},
|
|
func(path string, rof string) QuotaGetRefCommand {
|
|
return QuotaGetRefCommand{
|
|
AccountId: accountId,
|
|
IdsRef: &ResultReference{
|
|
Name: CommandQuotaChanges,
|
|
Path: path,
|
|
ResultOf: rof,
|
|
},
|
|
PropertiesRef: &ResultReference{
|
|
Name: CommandQuotaChanges,
|
|
Path: "/updatedProperties",
|
|
ResultOf: rof,
|
|
},
|
|
}
|
|
},
|
|
func(resp QuotaGetResponse) []Quota { return resp.List },
|
|
func(oldState, newState State, hasMoreChanges bool, updated []Quota) QuotaChanges {
|
|
return QuotaChanges{
|
|
OldState: oldState,
|
|
NewState: newState,
|
|
HasMoreChanges: hasMoreChanges,
|
|
Updated: updated,
|
|
}
|
|
},
|
|
ctx,
|
|
)
|
|
}
|