Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add missing functionalities to support API #40

Open
12 of 13 tasks
cojoj opened this issue Jun 25, 2015 · 24 comments
Open
12 of 13 tasks

Add missing functionalities to support API #40

cojoj opened this issue Jun 25, 2015 · 24 comments

Comments

@cojoj
Copy link
Contributor

cojoj commented Jun 25, 2015

Apple has left as with a table of supported endpoint in Xcode 7. It shows up that they're only providing some basic stuff but it's necessary for us to cover them all!
We're on a good way and already cover most but some of them are missing - not because we don't have code to support them but because a nice, convenience method hasn't beed written yet (you can do it).

In README you can see a table of features, so if you're planning to implement some of those missing methods, plase update README as well


Here's the list of all official endpoints:

  • List bots on server
  • Create a new bot
  • Retrieve a bot by ID
  • Update a bot’s configuration (will be tricky)
  • Get the most recent integrations for a bot
  • Enqueue a new integration
  • List integrations on server
  • Retrieve an integration by ID
  • List the commits included in an integration
  • List the build issues produced by an integration
  • List devices connected to server
  • List hosted repositories on server
  • Create a new hosted repository

Should be an easy one for anyone with 20mins on their hands.
-- @czechboy0 in #39


If you're wondering how to determine what endpoint will be used in official API, here's the list:

Type Path Description
GET /bots List bots on server
POST /bots Create a new bot
GET /bots/(id) Retrieve a bot by ID
PATCH /bots/(id) Update a bot’s configuration
GET /bots/(id)/integrations Get the most recent integrations for a bot
POST /bots/(id)/integrations Enqueue a new integration
GET /integrations List integrations on server
GET /integrations/(id) Retrieve an integration by ID
GET /integrations/(id)/commits List the commits included in an integration
GET /integrations/(id)/issues List the build issues produced by an integration
GET /devices List devices connected to server
GET /repositories List hosted repositories on server
POST /repositories Create a new hosted repository

If you need some motivation to start doing this task, please refer to #2 😉

@czechboy0
Copy link
Member

👍

@cojoj
Copy link
Contributor Author

cojoj commented Jun 27, 2015

I think I'll cover this if only I get OS X Server running on my MBP 😡

@cojoj
Copy link
Contributor Author

cojoj commented Jun 28, 2015

@czechboy0, @esttorhe I'm trying to update XcodeServerSDK to support missing API calls but I'm stuck on the first one... 😁

Update a bot’s configuration - how do you imagine the method signature for this one? I came with two ideas but don't know which one will be better:

  • public func updateBot(botId: String, withBot bot: Bot, overwriteBlueprint blueprint: Bool = true, completion: (success: Bool, error: NSError?) -> ())
  • public func updateBot(bot: Bot, overwriteBlueprint blueprint: Bool = true, completion: (success: Bool, error: NSError?) -> ())

In the first option you specify both: bot to update by ID and updating bot. In the latter you just provide updated bot with correct ID which will be used to PATCH existing bot. Which one do you prefer more?

@czechboy0
Copy link
Member

Hmm this one is actually pretty tricky. I suggest we leave that one for last 😆

@czechboy0
Copy link
Member

Also because some of the work I'm doing now will make the bot updating call much easier to work with. If you can take a look at List the build issues produced by an integration, List the commits included in an integration, Retrieve an integration by ID etc that'd be most useful.

@cojoj
Copy link
Contributor Author

cojoj commented Jun 28, 2015

Typical me - start working from the worst side 😐
Roger that, I will go for other things and leave this for later.

Thing that get stuck in my head after opening XcodeServer class - why not move those calls to separate files as extensions eg. XcodeServer+Bot, XcodeServer+Integrations. This way we'll only have generic sendRequestWithMethod() in XcodeServer class and get rid specific API calls. But I guess, we'll have to wait with this until your PR as this'll some introduce merge conflicts...

@czechboy0
Copy link
Member

Yeah I agree, now that there are more API calls it'd make sense to start splitting it. As you said, let's wait for that until this is merged (and even create an issue so that we don't forget).

@cojoj
Copy link
Contributor Author

cojoj commented Jun 28, 2015

@czechboy0 you know anything about integration commits? I have configured bot and if I run integration I always see that there are no commits related to this integration. Any idea when those commits are assigned to the integration?

@czechboy0
Copy link
Member

Yeah that's going to be a tricky one to test. The commits of an integration are the commits that have been pushed since the last integration. So I'd suggest you create a dummy branch, run an integration there once. Then, commit a couple of times there and then run an integration again. The second one should show all those commits. However, for debugging, you can also delete integrations (not just bots) through Xcode. This might help in development.

@cojoj
Copy link
Contributor Author

cojoj commented Jun 28, 2015

You're probably familiar with the output from /integrations/(id)/commits. What do you think should be returned to the end user? Only an array of commits? Because there are many, many other things...

screen shot 2015-06-28 at 19 02 53

@cojoj
Copy link
Contributor Author

cojoj commented Jun 28, 2015

Hmm, I guess I found answer... We're returning an array of commiters... But we probably don't have models for this, right? Same thing with issues and repositories, I guess...

@czechboy0
Copy link
Member

Nope, that's all yours 😉 Create model classes for Commits and committers and for whatever else makes sense.

@cojoj
Copy link
Contributor Author

cojoj commented Jun 28, 2015

Looks like it's a job for more than 20 min 😜

@czechboy0
Copy link
Member

Yeah that might have been an underestimate 😆

@cojoj
Copy link
Contributor Author

cojoj commented Jun 28, 2015

So if #44 is already merged, are we good to go with Updating a bot’s configuration? I'd prefer to finish non-new-stuff-required calls first and than jump on those more involving. Please, think about the method signature and let me know 😉

@czechboy0
Copy link
Member

Actually, PATCHing an existing bot is a bit more involved. If I were you I'd leave that for last. It's not that common of a call anyway (I never had it in Buildasaur). But I'll take a look at it next week some time.

@cojoj
Copy link
Contributor Author

cojoj commented Jun 28, 2015

Ok, as you wish 👌

@cojoj
Copy link
Contributor Author

cojoj commented Jun 28, 2015

Repositories are represented by a simple JSON:

{
      "readAccessExternalIDs": [],
      "writeAccessExternalIDs": [
        "FDF283F5-B9C3-4B43-9000-EF6A54934D4E",
        "ABCDEFAB-CDEF-ABCD-EFAB-CDEF00000050"
      ],
      "name": "Test2",
      "posixPermissions": 0,
      "httpAccessType": 1
}

There's no similarity between Repository and XcodeServerEntity. So, my question is, should we anyway create it as XcodeServerEntity child or maybe create a simple struct?

@czechboy0
Copy link
Member

I'll leave that to your judgement. I don't have a strong preference either way.

@czechboy0
Copy link
Member

Yay only 3 more API calls to support them all! The last two should be relatively easy, it's just work adding those model classes. And the Bot patching one I'll try to look at in the next couple of days.

@cojoj cojoj mentioned this issue Jul 20, 2015
@cojoj
Copy link
Contributor Author

cojoj commented Sep 1, 2015

One last to go...

@Sajjon
Copy link

Sajjon commented Oct 10, 2016

@czechboy0 what is the status of Update a bot’s configuration (will be tricky)?

Why is it tricky? And how tricky is it? this would be a great feature! since checking out code and building a project takes over 90% for each bot. Running the unit tests takes less than 10%, that is a big overhead!

I have btw created a Swift 3 branch for XcodeServerSDK and each pod it is dependent on: https://github.com/Sajjon/XcodeServerSDK
Should I create a PR maybe?

@Sajjon
Copy link

Sajjon commented Oct 12, 2016

@cojoj If I would try developing a Edit existing Bot feature, any ideas where to start? What are the primary challenges?

@cojoj
Copy link
Contributor Author

cojoj commented Oct 13, 2016

Whoa, it was a long time ago... And to be clear:


How I see it being tricky... You have to provide correct things to update bot. I guess the only required thing would be id, but I may be wrong (this needs to be checked). Also, updating sometimes can involve this multi stepping, so maybe some sort of builder for Bot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants