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

Implemented endpoints for modifying and removing Bundle IDs #60

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions Sources/Endpoints/Provisioning/Bundle IDs/ModifyBundleID.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
//
// ModifyBundleID.swift
// AppStoreConnect-Swift-SDK
//
// Created by Rui Costa on 30/12/2019.
//

import Foundation

extension APIEndpoint where T == BundleIdResponse {

/// Update a specific bundle ID’s name
/// - Parameter id: the bundle ID's id
/// - Parameter name: the bundle ID's name
public static func modify(
bundleIdWithId id: String,
name: String) -> APIEndpoint {

let request = BundleIdUpdateRequest(data: .init(
id: id,
attributes: .init(name: name)))

return APIEndpoint(
path: "bundleIds/\(id)",
method: .patch,
parameters: nil,
body: try? JSONEncoder().encode(request))
}
}
20 changes: 20 additions & 0 deletions Sources/Endpoints/Provisioning/Bundle IDs/RemoveBundleID.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
//
// RemoveBundleID.swift
// AppStoreConnect-Swift-SDK
//
// Created by Rui Costa on 30/12/2019.
//

import Foundation

extension APIEndpoint where T == Void {

/// Delete a bundle ID that is used for app development.
/// - Parameter id: the bundle ID's id
public static func remove(bundleIdWithId id: String) -> APIEndpoint {
return APIEndpoint(
path: "bundleIds/\(id)",
method: .delete,
parameters: nil)
}
}
31 changes: 31 additions & 0 deletions Sources/Models/BundleIdUpdateRequest.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
//
// BundleIdUpdateRequest.swift
// AppStoreConnect-Swift-SDK
//
// Created by Rui Costa on 30/12/2019.
//


Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Limit vertical whitespace to a single empty line. Currently 2.
vertical_whitespace BundleIdUpdateRequest.swift:8

import Foundation

/// A request containing a single resource.
public struct BundleIdUpdateRequest: Encodable {

/// The resource data.
public let data: Data
Copy link

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 BundleIdUpdateRequest.swift:15


public struct Data: Encodable {
public let id: String
public let attributes: Attributes
public let type: String = "bundleIds"
}
}

// MARK: BundleIdUpdateRequest.Data
extension BundleIdUpdateRequest.Data {

public struct Attributes: Encodable {
public let name: String
}
}

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Files should have a single trailing newline.
trailing_newline BundleIdUpdateRequest.swift:31