From aa00a4b094444515ccf5083bad6c924c0c652444 Mon Sep 17 00:00:00 2001 From: Eric Chiang Date: Wed, 6 Apr 2016 11:27:41 -0700 Subject: [PATCH] schema/workerschema: regenerate worker schema --- schema/workerschema/README.md | 77 ++++++++++++++ schema/workerschema/v1-gen.go | 177 ++++++++++++++++++++++++++++++++- schema/workerschema/v1-json.go | 75 ++++++++++++++ 3 files changed, 328 insertions(+), 1 deletion(-) diff --git a/schema/workerschema/README.md b/schema/workerschema/README.md index f8f2bf8c..203b3154 100644 --- a/schema/workerschema/README.md +++ b/schema/workerschema/README.md @@ -59,6 +59,31 @@ __Version:__ v1 } ``` +### RefreshClient + +A client with associated public metadata. + +``` +{ + clientID: string, + clientName: string, + clientURI: string, + logoURI: string +} +``` + +### RefreshClientList + + + +``` +{ + clients: [ + RefreshClient + ] +} +``` + ### ResendEmailInvitationRequest @@ -166,6 +191,58 @@ __Version:__ v1 ## Paths +### GET /account/{userid}/refresh + +> __Summary__ + +> List RefreshClient + +> __Description__ + +> List all clients that hold refresh tokens for the authenticated user. + + +> __Parameters__ + +> |Name|Located in|Description|Required|Type| +|:-----|:-----|:-----|:-----|:-----| +| userid | path | | Yes | string | + + +> __Responses__ + +> |Code|Description|Type| +|:-----|:-----|:-----| +| 200 | | [RefreshClientList](#refreshclientlist) | +| default | Unexpected error | | + + +### DELETE /account/{userid}/refresh/{clientid} + +> __Summary__ + +> Revoke Clients + +> __Description__ + +> Revoke all refresh tokens issues to the client for the authenticated user. + + +> __Parameters__ + +> |Name|Located in|Description|Required|Type| +|:-----|:-----|:-----|:-----|:-----| +| clientid | path | | Yes | string | +| userid | path | | Yes | string | + + +> __Responses__ + +> |Code|Description|Type| +|:-----|:-----|:-----| +| default | Unexpected error | | + + ### GET /clients > __Summary__ diff --git a/schema/workerschema/v1-gen.go b/schema/workerschema/v1-gen.go index 2d410541..9b71f95f 100644 --- a/schema/workerschema/v1-gen.go +++ b/schema/workerschema/v1-gen.go @@ -14,12 +14,13 @@ import ( "encoding/json" "errors" "fmt" - "google.golang.org/api/googleapi" "io" "net/http" "net/url" "strconv" "strings" + + "google.golang.org/api/googleapi" ) // Always reference these packages, just in case the auto-generated code @@ -45,6 +46,7 @@ func New(client *http.Client) (*Service, error) { } s := &Service{client: client, BasePath: basePath} s.Clients = NewClientsService(s) + s.RefreshClient = NewRefreshClientService(s) s.Users = NewUsersService(s) return s, nil } @@ -55,6 +57,8 @@ type Service struct { Clients *ClientsService + RefreshClient *RefreshClientService + Users *UsersService } @@ -67,6 +71,15 @@ type ClientsService struct { s *Service } +func NewRefreshClientService(s *Service) *RefreshClientService { + rs := &RefreshClientService{s: s} + return rs +} + +type RefreshClientService struct { + s *Service +} + func NewUsersService(s *Service) *UsersService { rs := &UsersService{s: s} return rs @@ -102,6 +115,20 @@ type Error struct { Error_description string `json:"error_description,omitempty"` } +type RefreshClient struct { + ClientID string `json:"clientID,omitempty"` + + ClientName string `json:"clientName,omitempty"` + + ClientURI string `json:"clientURI,omitempty"` + + LogoURI string `json:"logoURI,omitempty"` +} + +type RefreshClientList struct { + Clients []*RefreshClient `json:"clients,omitempty"` +} + type ResendEmailInvitationRequest struct { RedirectURL string `json:"redirectURL,omitempty"` } @@ -307,6 +334,154 @@ func (c *ClientsListCall) Do() (*ClientPage, error) { } +// method id "dex.Client.Revoke": + +type ClientsRevokeCall struct { + s *Service + userid string + clientid string + opt_ map[string]interface{} +} + +// Revoke: Revoke all refresh tokens issues to the client for the +// authenticated user. +func (r *ClientsService) Revoke(userid string, clientid string) *ClientsRevokeCall { + c := &ClientsRevokeCall{s: r.s, opt_: make(map[string]interface{})} + c.userid = userid + c.clientid = clientid + return c +} + +// Fields allows partial responses to be retrieved. +// See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse +// for more information. +func (c *ClientsRevokeCall) Fields(s ...googleapi.Field) *ClientsRevokeCall { + c.opt_["fields"] = googleapi.CombineFields(s) + return c +} + +func (c *ClientsRevokeCall) Do() error { + var body io.Reader = nil + params := make(url.Values) + params.Set("alt", "json") + if v, ok := c.opt_["fields"]; ok { + params.Set("fields", fmt.Sprintf("%v", v)) + } + urls := googleapi.ResolveRelative(c.s.BasePath, "account/{userid}/refresh/{clientid}") + urls += "?" + params.Encode() + req, _ := http.NewRequest("DELETE", urls, body) + googleapi.Expand(req.URL, map[string]string{ + "userid": c.userid, + "clientid": c.clientid, + }) + req.Header.Set("User-Agent", "google-api-go-client/0.5") + res, err := c.s.client.Do(req) + if err != nil { + return err + } + defer googleapi.CloseBody(res) + if err := googleapi.CheckResponse(res); err != nil { + return err + } + return nil + // { + // "description": "Revoke all refresh tokens issues to the client for the authenticated user.", + // "httpMethod": "DELETE", + // "id": "dex.Client.Revoke", + // "parameterOrder": [ + // "userid", + // "clientid" + // ], + // "parameters": { + // "clientid": { + // "location": "path", + // "required": true, + // "type": "string" + // }, + // "userid": { + // "location": "path", + // "required": true, + // "type": "string" + // } + // }, + // "path": "account/{userid}/refresh/{clientid}" + // } + +} + +// method id "dex.Client.List": + +type RefreshClientListCall struct { + s *Service + userid string + opt_ map[string]interface{} +} + +// List: List all clients that hold refresh tokens for the authenticated +// user. +func (r *RefreshClientService) List(userid string) *RefreshClientListCall { + c := &RefreshClientListCall{s: r.s, opt_: make(map[string]interface{})} + c.userid = userid + return c +} + +// Fields allows partial responses to be retrieved. +// See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse +// for more information. +func (c *RefreshClientListCall) Fields(s ...googleapi.Field) *RefreshClientListCall { + c.opt_["fields"] = googleapi.CombineFields(s) + return c +} + +func (c *RefreshClientListCall) Do() (*RefreshClientList, error) { + var body io.Reader = nil + params := make(url.Values) + params.Set("alt", "json") + if v, ok := c.opt_["fields"]; ok { + params.Set("fields", fmt.Sprintf("%v", v)) + } + urls := googleapi.ResolveRelative(c.s.BasePath, "account/{userid}/refresh") + urls += "?" + params.Encode() + req, _ := http.NewRequest("GET", urls, body) + googleapi.Expand(req.URL, map[string]string{ + "userid": c.userid, + }) + req.Header.Set("User-Agent", "google-api-go-client/0.5") + res, err := c.s.client.Do(req) + if err != nil { + return nil, err + } + defer googleapi.CloseBody(res) + if err := googleapi.CheckResponse(res); err != nil { + return nil, err + } + var ret *RefreshClientList + if err := json.NewDecoder(res.Body).Decode(&ret); err != nil { + return nil, err + } + return ret, nil + // { + // "description": "List all clients that hold refresh tokens for the authenticated user.", + // "httpMethod": "GET", + // "id": "dex.Client.List", + // "parameterOrder": [ + // "userid" + // ], + // "parameters": { + // "userid": { + // "location": "path", + // "required": true, + // "type": "string" + // } + // }, + // "path": "account/{userid}/refresh", + // "response": { + // "$ref": "RefreshClientList" + // } + // } + +} + // method id "dex.User.Create": type UsersCreateCall struct { diff --git a/schema/workerschema/v1-json.go b/schema/workerschema/v1-json.go index 4c1e1ba8..9e1eae21 100644 --- a/schema/workerschema/v1-json.go +++ b/schema/workerschema/v1-json.go @@ -55,6 +55,37 @@ const DiscoveryJSON = `{ } } }, + "RefreshClient": { + "id": "Client", + "type": "object", + "description": "A client with associated public metadata.", + "properties": { + "clientID": { + "type": "string" + }, + "clientName": { + "type": "string" + }, + "logoURI": { + "type": "string" + }, + "clientURI": { + "type": "string" + } + } + }, + "RefreshClientList": { + "id": "RefreshClientList", + "type": "object", + "properties": { + "clients": { + "type": "array", + "items": { + "$ref": "RefreshClient" + } + } + } + }, "ClientWithSecret": { "id": "Client", "type": "object", @@ -241,6 +272,27 @@ const DiscoveryJSON = `{ "response": { "$ref": "ClientWithSecret" } + }, + "Revoke": { + "id": "dex.Client.Revoke", + "description": "Revoke all refresh tokens issues to the client for the authenticated user.", + "httpMethod": "DELETE", + "path": "account/{userid}/refresh/{clientid}", + "parameterOrder": [ + "userid","clientid" + ], + "parameters": { + "clientid": { + "type": "string", + "required": true, + "location": "path" + }, + "userid": { + "type": "string", + "required": true, + "location": "path" + } + } } } }, @@ -341,6 +393,29 @@ const DiscoveryJSON = `{ } } } + }, + "RefreshClient": { + "methods": { + "List": { + "id": "dex.Client.List", + "description": "List all clients that hold refresh tokens for the authenticated user.", + "httpMethod": "GET", + "path": "account/{userid}/refresh", + "parameters": { + "userid": { + "type": "string", + "required": true, + "location": "path" + } + }, + "parameterOrder": [ + "userid" + ], + "response": { + "$ref": "RefreshClientList" + } + } + } } } }