Skip to content

Commit

Permalink
Add #67: Create Repositories for each API in bb consent and sub tickets:
Browse files Browse the repository at this point in the history
  • Loading branch information
Mumthasir mohammed authored and georgepadayatti committed Oct 23, 2023
1 parent 6f99f32 commit 8fbced4
Show file tree
Hide file tree
Showing 27 changed files with 362 additions and 259 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,12 @@
import Foundation
import SwiftyJSON

class ConsentHistory{

var iD : String!
var log : String!
var orgID : String!
var purposeID : String!
var timeStamp : String!

class ConsentHistory: ConsentHistoryWrapper {
var iD : String?
var log : String?
var orgID : String?
var purposeID : String?
var timeStamp : String?

/**
* Instantiate the instance using the passed json values to set the properties values
Expand All @@ -27,5 +25,12 @@ class ConsentHistory{
purposeID = json["PurposeID"].stringValue
timeStamp = json["TimeStamp"].stringValue
}
}

}
protocol ConsentHistoryWrapper {
var iD : String? { get }
var log : String? { get }
var orgID : String? { get }
var purposeID : String? { get }
var timeStamp : String? { get }
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@
import Foundation
import SwiftyJSON

class ConsentHistoryData{

var consentHistory : [ConsentHistory]!
var links : Link!
var unReadCount : Int!
class ConsentHistoryData {
var consentHistory : [ConsentHistory]?
var links : Link?
var unReadCount : Int?

/**
* Instantiate the instance using the passed json values to set the properties values
Expand All @@ -22,7 +21,7 @@ class ConsentHistoryData{
let consentHistoryArray = json["ConsentHistory"].arrayValue
for consentHistoryJson in consentHistoryArray{
let value = ConsentHistory(fromJson: consentHistoryJson)
consentHistory.append(value)
consentHistory?.append(value)
}
unReadCount = json["UnReadCount"].intValue
let linksJson = json["Links"]
Expand All @@ -31,5 +30,10 @@ class ConsentHistoryData{
links = Link(fromJson: linksJson)
}
}
}

protocol ConsentHistoryDataWrapper {
var consentHistory : [ConsentHistoryWrapper]? { get }
var links : Link? { get }
var unReadCount : Int? { get }
}
12 changes: 7 additions & 5 deletions PrivacyDashboardiOS/Classes/Model/Link.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,9 @@
import Foundation
import SwiftyJSON

class Link{

var next : String!
var current : String!

class Link: LinkWrapper {
var next : String?
var current : String?

/**
* Instantiate the instance using the passed json values to set the properties values
Expand All @@ -21,5 +19,9 @@ class Link{
next = json["next"].stringValue
current = json["self"].stringValue
}
}

protocol LinkWrapper {
var next : String? { get }
var current : String? { get }
}
63 changes: 36 additions & 27 deletions PrivacyDashboardiOS/Classes/Model/Organisation/Consent.swift
Original file line number Diff line number Diff line change
@@ -1,35 +1,44 @@
//
// Consent.swift
// Model file generated using JSONExport: https://github.com/Ahmed-Ali/JSONExport
// Consent.swift
// Model file generated using JSONExport: https://github.com/Ahmed-Ali/JSONExport

import Foundation
import Foundation
import SwiftyJSON

class Consent {
class Consent: ConsentWrapper {

var data : String!
var iD : String!
var orgID : String!
var status : Status!
var userID : String!
var value : String!
var data : String?
var iD : String?
var orgID : String?
var status : StatusWrapper?
var userID : String?
var value : String?


/**
* Instantiate the instance using the passed json values to set the properties values
*/
init(fromJson json: JSON!) {
if json.isEmpty{
return
}
data = json["Data"].stringValue
iD = json["ID"].stringValue
orgID = json["OrgID"].stringValue
let statusJson = json["Status"]
if !statusJson.isEmpty{
status = Status(fromJson: statusJson)
}
userID = json["UserID"].stringValue
value = json["Value"].stringValue
}
/**
* Instantiate the instance using the passed json values to set the properties values
*/
init(fromJson json: JSON!) {
if json.isEmpty{
return
}
data = json["Data"].stringValue
iD = json["ID"].stringValue
orgID = json["OrgID"].stringValue
let statusJson = json["Status"]
if !statusJson.isEmpty{
status = Status(fromJson: statusJson)
}
userID = json["UserID"].stringValue
value = json["Value"].stringValue
}
}

protocol ConsentWrapper {
var data : String? { get }
var iD : String? { get }
var orgID : String? { get }
var status : StatusWrapper? { get }
var userID : String? { get }
var value : String? { get }
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,10 @@ import Foundation
import SwiftyJSON

class ConsentDetails {

var descriptionField : String!
var iD : String!
var status : ConsentStatus!
var value : String!

var descriptionField : String?
var iD : String?
var status : ConsentStatusWrapper?
var value : String?

/**
* Instantiate the instance using the passed json values to set the properties values
Expand All @@ -29,3 +27,10 @@ class ConsentDetails {
value = json["Value"].stringValue
}
}

protocol ConsentDetailsWrapper {
var descriptionField : String? { get }
var iD : String? { get }
var status : ConsentStatusWrapper? { get }
var value : String? { get }
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,13 @@ import Foundation
import SwiftyJSON

class ConsentListDetails {

var descriptionField : String!
var iD : String!
var status : ConsentStatus!
var value : String!
var consents : [Consent]!
var count : Count!
var purpose : Purpose!

var descriptionField : String?
var iD : String?
var status : ConsentStatus?
var value : String?
var consents : [Consent]?
var count : Count?
var purpose : Purpose?

/**
* Instantiate the instance using the passed json values to set the properties values
Expand All @@ -34,7 +32,7 @@ class ConsentListDetails {
let consentsArray = json["Consents"].arrayValue
for consentsJson in consentsArray{
let value = Consent(fromJson: consentsJson)
consents.append(value)
consents?.append(value)
}
let countJson = json["Count"]
if !countJson.isEmpty{
Expand All @@ -46,3 +44,13 @@ class ConsentListDetails {
}
}
}

protocol ConsentListDetailsWrapper {
var descriptionField : String? { get }
var iD : String? { get }
var status : ConsentStatus? { get }
var value : String? { get }
var consents : [Consent]? { get }
var count : Count? { get }
var purpose : Purpose? { get }
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,12 @@
import Foundation
import SwiftyJSON

class ConsentListingResponse {

var consentID : String!
var consents : PurposeDetails!
var iD : String!
var orgID : String!
var userID : String!
class ConsentListingResponse: ConsentListingResponseWrapper {
var consentID : String?
var consents : PurposeDetails?
var iD : String?
var orgID : String?
var userID : String?

/**
* Instantiate the instance using the passed json values to set the properties values
Expand All @@ -30,3 +29,12 @@ class ConsentListingResponse {
userID = json["UserID"].stringValue
}
}


protocol ConsentListingResponseWrapper {
var consentID : String? { get }
var consents : PurposeDetails? { get }
var iD : String? { get }
var orgID : String? { get }
var userID : String? { get }
}
46 changes: 26 additions & 20 deletions PrivacyDashboardiOS/Classes/Model/Organisation/ConsentStatus.swift
Original file line number Diff line number Diff line change
@@ -1,28 +1,27 @@
//
// Statu.swift
// Model file generated using JSONExport: https://github.com/Ahmed-Ali/JSONExport
// Statu.swift
// Model file generated using JSONExport: https://github.com/Ahmed-Ali/JSONExport

import Foundation
import Foundation
import SwiftyJSON

class ConsentStatus {
class ConsentStatus: ConsentStatusWrapper {
var consented = ConsentType.Allow
var days : Int?
var remaining : Int?
var timeStamp : String?

var consented = ConsentType.Allow
var days : Int!
var remaining : Int!
var timeStamp : String!

/**
* Instantiate the instance using the passed json values to set the properties values
*/
init(fromJson json: JSON!) {
if json.isEmpty{
return
}
/**
* Instantiate the instance using the passed json values to set the properties values
*/
init(fromJson json: JSON!) {
if json.isEmpty{
return
}
// consented = json["Consented"].stringValue
days = json["Days"].intValue
remaining = json["Remaining"].intValue
timeStamp = json["TimeStamp"].stringValue
days = json["Days"].intValue
remaining = json["Remaining"].intValue
timeStamp = json["TimeStamp"].stringValue
if json["Consented"].stringValue.lowercased() == "Allow".lowercased(){
consented = .Allow
}
Expand All @@ -35,5 +34,12 @@ class ConsentStatus {
else{
consented = .AskMe
}
}
}
}

protocol ConsentStatusWrapper {
var consented: ConsentType { get set }
var days : Int? { get set }
var remaining : Int? { get }
var timeStamp : String? { get }
}
37 changes: 20 additions & 17 deletions PrivacyDashboardiOS/Classes/Model/Organisation/Count.swift
Original file line number Diff line number Diff line change
@@ -1,24 +1,27 @@
//
// Count.swift
// Model file generated using JSONExport: https://github.com/Ahmed-Ali/JSONExport
// Count.swift
// Model file generated using JSONExport: https://github.com/Ahmed-Ali/JSONExport

import Foundation
import Foundation
import SwiftyJSON

class Count {

var consented : Int!
var total : Int!
class Count: CountWrapper {
var consented : Int?
var total : Int?

/**
* Instantiate the instance using the passed json values to set the properties values
*/
init(fromJson json: JSON!) {
if json.isEmpty{
return
}
consented = json["Consented"].intValue
total = json["Total"].intValue
}
}

/**
* Instantiate the instance using the passed json values to set the properties values
*/
init(fromJson json: JSON!) {
if json.isEmpty{
return
}
consented = json["Consented"].intValue
total = json["Total"].intValue
}
protocol CountWrapper {
var consented : Int? { get }
var total : Int? { get }
}
Loading

0 comments on commit 8fbced4

Please sign in to comment.