From 104c9761c656d8bf7e1084d517c648443afeaebe Mon Sep 17 00:00:00 2001 From: Bobby Rullo Date: Wed, 15 Jun 2016 10:48:20 -0700 Subject: [PATCH] schema: remove clients API The only thing using this AFAIK is dexctl in api_driver mode, which no-one uses - it's a sort of weird API which requires a client to create other clients, and gives all clients the ability to list all other clients. So we are removing it. --- schema/workerschema/README.md | 94 +----------------- schema/workerschema/v1-gen.go | 174 --------------------------------- schema/workerschema/v1-json.go | 81 --------------- schema/workerschema/v1.json | 81 --------------- 4 files changed, 1 insertion(+), 429 deletions(-) diff --git a/schema/workerschema/README.md b/schema/workerschema/README.md index 0218864a..5421d932 100644 --- a/schema/workerschema/README.md +++ b/schema/workerschema/README.md @@ -8,46 +8,6 @@ __Version:__ v1 ## Models -### Client - - - -``` -{ - id: string, - redirectURIs: [ - string - ] -} -``` - -### ClientPage - - - -``` -{ - clients: [ - Client - ], - nextPageToken: string -} -``` - -### ClientWithSecret - - - -``` -{ - id: string, - redirectURIs: [ - string - ], - secret: string -} -``` - ### Error @@ -243,58 +203,6 @@ A client with associated public metadata. | default | Unexpected error | | -### GET /clients - -> __Summary__ - -> List Clients - -> __Description__ - -> Retrieve a page of Client objects. - - -> __Parameters__ - -> |Name|Located in|Description|Required|Type| -|:-----|:-----|:-----|:-----|:-----| -| nextPageToken | query | | No | string | - - -> __Responses__ - -> |Code|Description|Type| -|:-----|:-----|:-----| -| 200 | | [ClientPage](#clientpage) | -| default | Unexpected error | | - - -### POST /clients - -> __Summary__ - -> Create Clients - -> __Description__ - -> Register a new Client. - - -> __Parameters__ - -> |Name|Located in|Description|Required|Type| -|:-----|:-----|:-----|:-----|:-----| -| | body | | Yes | [Client](#client) | - - -> __Responses__ - -> |Code|Description|Type| -|:-----|:-----|:-----| -| 200 | | [ClientWithSecret](#clientwithsecret) | -| default | Unexpected error | | - - ### GET /users > __Summary__ @@ -310,8 +218,8 @@ A client with associated public metadata. > |Name|Located in|Description|Required|Type| |:-----|:-----|:-----|:-----|:-----| -| nextPageToken | query | | No | string | | maxResults | query | | No | integer | +| nextPageToken | query | | No | string | > __Responses__ diff --git a/schema/workerschema/v1-gen.go b/schema/workerschema/v1-gen.go index 4a2fbd0c..17906dd6 100644 --- a/schema/workerschema/v1-gen.go +++ b/schema/workerschema/v1-gen.go @@ -45,7 +45,6 @@ func New(client *http.Client) (*Service, error) { return nil, errors.New("client is nil") } s := &Service{client: client, BasePath: basePath} - s.Clients = NewClientsService(s) s.RefreshClient = NewRefreshClientService(s) s.Users = NewUsersService(s) return s, nil @@ -55,22 +54,11 @@ type Service struct { client *http.Client BasePath string // API endpoint base URL - Clients *ClientsService - RefreshClient *RefreshClientService Users *UsersService } -func NewClientsService(s *Service) *ClientsService { - rs := &ClientsService{s: s} - return rs -} - -type ClientsService struct { - s *Service -} - func NewRefreshClientService(s *Service) *RefreshClientService { rs := &RefreshClientService{s: s} return rs @@ -89,26 +77,6 @@ type UsersService struct { s *Service } -type Client struct { - Id string `json:"id,omitempty"` - - RedirectURIs []string `json:"redirectURIs,omitempty"` -} - -type ClientPage struct { - Clients []*Client `json:"clients,omitempty"` - - NextPageToken string `json:"nextPageToken,omitempty"` -} - -type ClientWithSecret struct { - Id string `json:"id,omitempty"` - - RedirectURIs []string `json:"redirectURIs,omitempty"` - - Secret string `json:"secret,omitempty"` -} - type Error struct { Error string `json:"error,omitempty"` @@ -192,148 +160,6 @@ type UsersResponse struct { Users []*User `json:"users,omitempty"` } -// method id "dex.Client.Create": - -type ClientsCreateCall struct { - s *Service - client *Client - opt_ map[string]interface{} -} - -// Create: Register a new Client. -func (r *ClientsService) Create(client *Client) *ClientsCreateCall { - c := &ClientsCreateCall{s: r.s, opt_: make(map[string]interface{})} - c.client = client - 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 *ClientsCreateCall) Fields(s ...googleapi.Field) *ClientsCreateCall { - c.opt_["fields"] = googleapi.CombineFields(s) - return c -} - -func (c *ClientsCreateCall) Do() (*ClientWithSecret, error) { - var body io.Reader = nil - body, err := googleapi.WithoutDataWrapper.JSONReader(c.client) - if err != nil { - return nil, err - } - ctype := "application/json" - 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, "clients") - urls += "?" + params.Encode() - req, _ := http.NewRequest("POST", urls, body) - googleapi.SetOpaque(req.URL) - req.Header.Set("Content-Type", ctype) - 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 *ClientWithSecret - if err := json.NewDecoder(res.Body).Decode(&ret); err != nil { - return nil, err - } - return ret, nil - // { - // "description": "Register a new Client.", - // "httpMethod": "POST", - // "id": "dex.Client.Create", - // "path": "clients", - // "request": { - // "$ref": "Client" - // }, - // "response": { - // "$ref": "ClientWithSecret" - // } - // } - -} - -// method id "dex.Client.List": - -type ClientsListCall struct { - s *Service - opt_ map[string]interface{} -} - -// List: Retrieve a page of Client objects. -func (r *ClientsService) List() *ClientsListCall { - c := &ClientsListCall{s: r.s, opt_: make(map[string]interface{})} - return c -} - -// NextPageToken sets the optional parameter "nextPageToken": -func (c *ClientsListCall) NextPageToken(nextPageToken string) *ClientsListCall { - c.opt_["nextPageToken"] = nextPageToken - 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 *ClientsListCall) Fields(s ...googleapi.Field) *ClientsListCall { - c.opt_["fields"] = googleapi.CombineFields(s) - return c -} - -func (c *ClientsListCall) Do() (*ClientPage, error) { - var body io.Reader = nil - params := make(url.Values) - params.Set("alt", "json") - if v, ok := c.opt_["nextPageToken"]; ok { - params.Set("nextPageToken", fmt.Sprintf("%v", v)) - } - if v, ok := c.opt_["fields"]; ok { - params.Set("fields", fmt.Sprintf("%v", v)) - } - urls := googleapi.ResolveRelative(c.s.BasePath, "clients") - urls += "?" + params.Encode() - req, _ := http.NewRequest("GET", urls, body) - googleapi.SetOpaque(req.URL) - 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 *ClientPage - if err := json.NewDecoder(res.Body).Decode(&ret); err != nil { - return nil, err - } - return ret, nil - // { - // "description": "Retrieve a page of Client objects.", - // "httpMethod": "GET", - // "id": "dex.Client.List", - // "parameters": { - // "nextPageToken": { - // "location": "query", - // "type": "string" - // } - // }, - // "path": "clients", - // "response": { - // "$ref": "ClientPage" - // } - // } - -} - // method id "dex.RefreshClient.List": type RefreshClientListCall struct { diff --git a/schema/workerschema/v1-json.go b/schema/workerschema/v1-json.go index 5160e89d..8c7b43fc 100644 --- a/schema/workerschema/v1-json.go +++ b/schema/workerschema/v1-json.go @@ -39,22 +39,6 @@ const DiscoveryJSON = `{ } } }, - "Client": { - "id": "Client", - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "redirectURIs": { - "required": true, - "type": "array", - "items": { - "type": "string" - } - } - } - }, "RefreshClient": { "id": "Client", "type": "object", @@ -86,40 +70,6 @@ const DiscoveryJSON = `{ } } }, - "ClientWithSecret": { - "id": "Client", - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "secret": { - "type": "string" - }, - "redirectURIs": { - "required": true, - "type": "array", - "items": { - "type": "string" - } - } - } - }, - "ClientPage": { - "id": "ClientPage", - "type": "object", - "properties": { - "clients": { - "type": "array", - "items": { - "$ref": "Client" - } - }, - "nextPageToken": { - "type": "string" - } - } - }, "User": { "id": "User", "type": "object", @@ -244,37 +194,6 @@ const DiscoveryJSON = `{ } }, "resources": { - "Clients": { - "methods": { - "List": { - "id": "dex.Client.List", - "description": "Retrieve a page of Client objects.", - "httpMethod": "GET", - "path": "clients", - "parameters": { - "nextPageToken": { - "type": "string", - "location": "query" - } - }, - "response": { - "$ref": "ClientPage" - } - }, - "Create": { - "id": "dex.Client.Create", - "description": "Register a new Client.", - "httpMethod": "POST", - "path": "clients", - "request": { - "$ref": "Client" - }, - "response": { - "$ref": "ClientWithSecret" - } - } - } - }, "Users": { "methods": { "List": { diff --git a/schema/workerschema/v1.json b/schema/workerschema/v1.json index 76ca8bf5..47a3a90c 100644 --- a/schema/workerschema/v1.json +++ b/schema/workerschema/v1.json @@ -33,22 +33,6 @@ } } }, - "Client": { - "id": "Client", - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "redirectURIs": { - "required": true, - "type": "array", - "items": { - "type": "string" - } - } - } - }, "RefreshClient": { "id": "Client", "type": "object", @@ -80,40 +64,6 @@ } } }, - "ClientWithSecret": { - "id": "Client", - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "secret": { - "type": "string" - }, - "redirectURIs": { - "required": true, - "type": "array", - "items": { - "type": "string" - } - } - } - }, - "ClientPage": { - "id": "ClientPage", - "type": "object", - "properties": { - "clients": { - "type": "array", - "items": { - "$ref": "Client" - } - }, - "nextPageToken": { - "type": "string" - } - } - }, "User": { "id": "User", "type": "object", @@ -238,37 +188,6 @@ } }, "resources": { - "Clients": { - "methods": { - "List": { - "id": "dex.Client.List", - "description": "Retrieve a page of Client objects.", - "httpMethod": "GET", - "path": "clients", - "parameters": { - "nextPageToken": { - "type": "string", - "location": "query" - } - }, - "response": { - "$ref": "ClientPage" - } - }, - "Create": { - "id": "dex.Client.Create", - "description": "Register a new Client.", - "httpMethod": "POST", - "path": "clients", - "request": { - "$ref": "Client" - }, - "response": { - "$ref": "ClientWithSecret" - } - } - } - }, "Users": { "methods": { "List": {