Skip to content

Commit

Permalink
Update to docs
Browse files Browse the repository at this point in the history
  • Loading branch information
johnpcarter committed Oct 14, 2020
1 parent 153361c commit 8106598
Show file tree
Hide file tree
Showing 11 changed files with 978 additions and 421 deletions.
2 changes: 1 addition & 1 deletion Cumulocity Client Library.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -369,10 +369,10 @@
children = (
F0A7EC2725344BCA00472615 /* AssetCollection.swift */,
F0A7EC2825344BCA00472615 /* Device.swift */,
F0A7EC2C25344BCA00472615 /* MutableDevice.swift */,
F0A7EC2925344BCA00472615 /* EditableDevice.swift */,
F0A7EC2A25344BCA00472615 /* EditableGroup.swift */,
F0A7EC2B25344BCA00472615 /* Group.swift */,
F0A7EC2C25344BCA00472615 /* MutableDevice.swift */,
);
path = devices;
sourceTree = "<group>";
Expand Down
11 changes: 6 additions & 5 deletions Sources/c8y-lib/api/ManagedObjectService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -253,12 +253,13 @@ public class C8yManagedObjectsService: JcConnectionRequest<C8yCumulocityConnecti
public func post(_ object: C8yManagedObject) throws -> AnyPublisher<JcRequestResponse<C8yManagedObject>, APIError> {

return try super._execute(method: JcConnectionRequest.Method.POST, resourcePath: C8Y_MANAGED_OBJECTS_API, contentType: "application/json", request: object).map({ (response) -> JcRequestResponse<C8yManagedObject> in
let location: String = response.httpHeaders![JC_HEADER_LOCATION] as! String
let id = String(location[location.index(location.lastIndex(of: "/")!, offsetBy: 1)...])
var updatedObject = object
updatedObject.updateId(id)

return JcRequestResponse<C8yManagedObject>(response, content: updatedObject)
let location: String = response.httpHeaders![JC_HEADER_LOCATION] as! String
let id = String(location[location.index(location.lastIndex(of: "/")!, offsetBy: 1)...])
var updatedObject = object
updatedObject.updateId(id)

return JcRequestResponse<C8yManagedObject>(response, content: updatedObject)
}).eraseToAnyPublisher()
}

Expand Down
6 changes: 3 additions & 3 deletions Sources/c8y-lib/custom/model/Model.swift
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public struct C8yModel: C8yCustomAsset, Hashable {

public private(set) var id: String = ""
public private(set) var name: String = ""
public private(set) var category: C8yDeviceCategory = .Unknown
public private(set) var category: C8yDevice.DeviceCategory = .Unknown
public private(set) var description: String? = nil
public private(set) var link: String? = ""
internal private(set) var imageId: String? = nil
Expand All @@ -64,7 +64,7 @@ public struct C8yModel: C8yCustomAsset, Hashable {
case imageId
}

init(_ id: String, name: String, category: C8yDeviceCategory, link: String?, description: String? = nil, image: UIImage? = nil) {
init(_ id: String, name: String, category: C8yDevice.DeviceCategory, link: String?, description: String? = nil, image: UIImage? = nil) {

self.id = id
self.name = name
Expand All @@ -83,7 +83,7 @@ public struct C8yModel: C8yCustomAsset, Hashable {
self.link = try container.decode(String.self, forKey: .link)

if (container.contains(.category)) {
self.category = try C8yDeviceCategory(rawValue: container.decode(String.self, forKey: .category))!
self.category = try C8yDevice.DeviceCategory(rawValue: container.decode(String.self, forKey: .category))!
}
}

Expand Down
Loading

0 comments on commit 8106598

Please sign in to comment.