-
-
Notifications
You must be signed in to change notification settings - Fork 196
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 support for Bundle IDs and Capabilities endpoints #57
Add support for Bundle IDs and Capabilities endpoints #57
Conversation
Sources/Models/BundleId.swift
Outdated
public struct BundleId: Codable { | ||
|
||
/// The resource's attributes. | ||
public let attributes: BundleId.Attributes? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An ‘instance_property’ should not be placed amongst the type content(s) ‘subtype’.type_contents_order BundleId.swift:14 |
Sources/Models/BundleId.swift
Outdated
public let attributes: BundleId.Attributes? | ||
|
||
/// The opaque resource ID that uniquely identifies the resource. | ||
public let `id`: String |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An ‘instance_property’ should not be placed amongst the type content(s) ‘subtype’.type_contents_order BundleId.swift:17 |
Sources/Models/BundleId.swift
Outdated
public let `id`: String | ||
|
||
/// Navigational links to related data and included resource types and IDs. | ||
public let relationships: BundleId.Relationships? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An ‘instance_property’ should not be placed amongst the type content(s) ‘subtype’.type_contents_order BundleId.swift:20 |
Sources/Models/BundleId.swift
Outdated
public let relationships: BundleId.Relationships? | ||
|
||
/// The resource type.Value: bundleIds | ||
public let type: String = "bundleIds" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An ‘instance_property’ should not be placed amongst the type content(s) ‘subtype’.type_contents_order BundleId.swift:23 |
Sources/Models/BundleId.swift
Outdated
public let type: String = "bundleIds" | ||
|
||
/// Navigational links that include the self-link. | ||
public let links: ResourceLinks<BundleIdResponse> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An ‘instance_property’ should not be placed amongst the type content(s) ‘subtype’.type_contents_order BundleId.swift:26 |
Sources/Endpoints/Provisioning/Bundle ID Capabilities/DisableCapability.swift
Outdated
Show resolved
Hide resolved
import Foundation | ||
|
||
/// A response containing a list of related resource IDs. | ||
public struct BundleIdCapabilitiesResponse: Codable { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Conforming to Decodable
only should suffice here, can this be adjusted? The same should apply to the other response types and most of the nested types.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Every other model conforms to Codable
. Searching for types conforming to Codable
results in 418 results, searching for Decodable
yields only 15 results (mostly related to this PR actually). Should we for consistency keep everything conform to Codable
? I change change all instances in this PR to conform to Codable
instead of just Decodable
like the rest of the codebase.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for looking into this @BalestraPatrick! I'm happy to stick to the conventions already in use in the project.
import Foundation | ||
|
||
/// A request containing a single resource. | ||
public struct BundleIdCapabilityCreateRequest: Codable { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similarly, if should be enough conforming to Encodable
here (and other request types), as well as most nested types.
If you don't get the same warnings locally as here in CI, you might want to update the WeTransfer-iOS-CI submodule. This makes sure that SwiftLint is run locally as well and triggers the same warnings locally. I'll see if I can make this process easier to understand. |
@ruipfcosta @AvdLee This is ready for another round of review whenever you have time 👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Amazing job, Patrick! Great job on keeping the code consistent with the rest of the project. I've got a small suggestion and I'm interested to hear your thoughts on it!
- Add support for all [Bundle ID](https://developer.apple.com/documentation/appstoreconnectapi/bundle_ids) endpoints. (@ruipfcosta, @BalestraPatrick) | ||
- Add support for all [Bundle ID Capabilities](https://developer.apple.com/documentation/appstoreconnectapi/bundle_id_capabilities) endpoints. (@BalestraPatrick) | ||
- Updated CI to make sure PR requests are reviewed using Danger. (@AvdLee) | ||
- Removed custom Result type. (@ruipfcosta) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work on the details here!
path: "bundleIdCapabilities", | ||
method: .post, | ||
parameters: nil, | ||
body: try? JSONEncoder().encode(request)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If encoding here fails, it would fail silently. This might make it harder to debug eventually if it's causing the request to fail as well. What do you think about making the enableCapability
method throwing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I took inspiration from all other methods that don't propagate the failure right now. There are other 36 instances of try? JSONEncoder().encode(request)
in the project, so not sure it's worth changing these new methods to a new convention.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, you're right! Lets keep it like this for now.
Congratulations! 🎉 This was released as part of Release 1.0.0 🚀 |
This PR implements all the Bundle ID Capabilities and Bundle IDs endpoints.
Sorry for the big PR, but a lot of models are shared between the two web services. I have the
Profiles
andDevices
endpoints ready too, but I was able to split those into a different future PR to make it easier to review.Feedback is welcome on the API design and everything. I did some smoke tests for all the endpoints and they work just fine.