Add Create/Get/Delete for oauth2 apps #305

Merged
6543 merged 1 commits from :master into master 2020-04-06 22:02:22 +00:00
Contributor

After doing some discovery work for integrating into Gitea, I noticed I couldn’t programmatically create Oauth2 applications. This PR adds Create, List, and Delete, for Oauth2 User Applications.

However, Update, Edit and Get aren’t implemented in the API, so no attempt was made to create subscribers for those endpoints.

After doing some discovery work for integrating into Gitea, I noticed I couldn’t programmatically create Oauth2 applications. This PR adds Create, List, and Delete, for Oauth2 User Applications. However, Update, Edit and Get aren’t implemented in the API, so no attempt was made to create subscribers for those endpoints.
6543 added the
kind/feature
label 2020-04-06 19:39:36 +00:00
6543 added this to the v0.12.0 milestone 2020-04-06 19:39:41 +00:00
Owner

@graytshirt pleace update pr description

@graytshirt pleace update pr description
techknowlogick reviewed 2020-04-06 19:52:52 +00:00
Dismissed
gitea/oauth2.go Outdated
@ -0,0 +1,56 @@
// Copyright 2019 The Gitea Authors. All rights reserved.

Tiny nit, could you change this to 2020?

Tiny nit, could you change this to 2020?
Author
Contributor

oh, for sure my bad! I just updated and squashed!

oh, for sure my bad! I just updated and squashed!

haha, it's ok, I get caught by that myself too. Thanks for PR 😄

haha, it's ok, I get caught by that myself too. Thanks for PR :smile:
techknowlogick approved these changes 2020-04-06 20:48:50 +00:00
Dismissed
6543 started working 2020-04-06 21:23:19 +00:00
Owner

@graytshirt looks good 🎉 two things ...

since this api endpoints are in >= v1.12.0 pleace add a version check

example: https://gitea.com/gitea/go-sdk/src/branch/master/gitea/issue.go#L121

and thigs from code review

@graytshirt looks good :tada: two things ... since this api endpoints are in >= v1.12.0 pleace add a version check example: https://gitea.com/gitea/go-sdk/src/branch/master/gitea/issue.go#L121 and thigs from code review
6543 requested changes 2020-04-06 21:36:32 +00:00
Dismissed
gitea/oauth2.go Outdated
@ -0,0 +1,56 @@
// Copyright 2019 The Gitea Authors. All rights reserved.
Owner

2020 :D

2020 :D
Author
Contributor

done.

done.
gitea/oauth2.go Outdated
@ -0,0 +50,4 @@
}
// DeleteOauth2 delete an Oauth2 application by name
func (c *Client) DeleteOauth2(oauth2name string) error {
Owner

this should be an integer since api like to have oauth2app id -> https://try.gitea.io/api/swagger#/user/userDeleteOAuth2Application

this should be an integer since api like to have oauth2app id -> https://try.gitea.io/api/swagger#/user/userDeleteOAuth2Application
Author
Contributor

yeap. done.

yeap. done.
@ -0,0 +28,4 @@
assert.Len(t, a, 1)
assert.EqualValues(t, newApp.Name, a[0].Name)
assert.NoError(t, c.DeleteOauth2(newApp.Name))
Owner

use .ID

use .ID
Author
Contributor

yeap. done.

yeap. done.
Owner

I'm not sure why CI passed with Name for deletion - I'll have a look at it later.

I'm not sure why CI passed with Name for deletion - I'll have a look at it later.
6543 stopped working 2020-04-06 21:40:05 +00:00
16min 46s
6543 changed title from Add commands for user oauth2 apps to Add Create/Get/Delete for oauth2 apps 2020-04-06 21:43:37 +00:00
Author
Contributor

I took a fail early approach with checking the version, hope that's okay

I took a fail early approach with checking the version, hope that's okay
6543 approved these changes 2020-04-06 22:01:37 +00:00
Dismissed
6543 closed this pull request 2020-04-06 22:02:22 +00:00
Author
Contributor

sweet! thanks!

sweet! thanks!
Sign in to join this conversation.
No description provided.