Skip to content

Instantly share code, notes, and snippets.

@YordiLorenzo
Created October 31, 2019 07:30
Show Gist options
  • Save YordiLorenzo/414edbfc0788f9ec9fdfed784bb54078 to your computer and use it in GitHub Desktop.
Save YordiLorenzo/414edbfc0788f9ec9fdfed784bb54078 to your computer and use it in GitHub Desktop.
open class GetJobService<T: Mappable>: BaseService<T, ErrorMappable> {
open var hashId: String
public init (hashId: String) {
self.hashId = hashId
}
open override var endpoint: String {
return "api/v1/contractor/jobs/" + hashId + "?include=open_shifts.contractor_match.contractor,open_shifts.contractor_match.shift,open_shifts.contractor_match.contractor_has_worked_before,open_shifts.contractor_match.tariff_incl_costs,open_shifts.contractor_match.actions,open_shifts.contractor_match.contractor_status,open_shifts.contractor_match.substituted_by,open_shifts.contractor_match.substituting_for,open_shifts.contractor_match.can_claim_cancellation_fee,work_shifts.contractor_match.contractor,work_shifts.contractor_match.shift,work_shifts.contractor_match.contractor_has_worked_before,work_shifts.contractor_match.tariff_incl_costs,work_shifts.contractor_match.actions,work_shifts.contractor_match.contractor_status,work_shifts.contractor_match.substituted_by,work_shifts.contractor_match.substituting_for,work_shifts.contractor_match.can_claim_cancellation_fee,finished_shifts.contractor_match.contractor,finished_shifts.contractor_match.shift,finished_shifts.contractor_match.contractor_has_worked_before,finished_shifts.contractor_match.tariff_incl_costs,finished_shifts.contractor_match.actions,finished_shifts.contractor_match.contractor_status,finished_shifts.contractor_match.substituted_by,finished_shifts.contractor_match.substituting_for,finished_shifts.contractor_match.can_claim_cancellation_fee,report_at_address.distance_from_user_home,photos,skills,client.photos,appearances,tips,contractor,job_category,location,negotiation_allowed"
}
open override var headers: Dictionary<String, String>? {
if TSessionManager.sharedInstance.state == .loggedIn {
return Dictionary<String, String>
.fromHttpHeaders(headers: Headers.AcceptApplicationJson,
Headers.ContentTypeJson,
Headers.Authorization)
}
return Dictionary<String, String>
.fromHttpHeaders(headers: Headers.AcceptApplicationJson,
Headers.ContentTypeJson)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment