测试测试过 | ✗ |
语言语言 | SwiftSwift |
许可证 | Apache 2 |
发布最后发布 | 2016年6月 |
SPM支持 SPM | ✗ |
由 Christopher Trudeau、Conner Brennick、Richard Puckett 维护。
依赖于: | |
Alamofire | ~> 3.4 |
SwiftyJSON | ~> 2.3.1 |
Concur APIs 的 Swift SDK。
要开始使用 SwiftyConcur,您可以使用 CocoaPods 将其添加到项目中
platform :ios, '9.0'
use_frameworks!
pod 'SwiftyConcur'
要运行 SwiftyConcur 的单元测试,打开 SwiftyConcuriOSExample 工作区并运行以下命令之一
产品 -> 测试
CMD + U
要获取对 Concur APIs 的访问权限,您需要一个带有 Concur 的开发者账户。您可以通过在此 注册 获取一个。您的账户将包含一个 Key 和 Secret,这是 SwiftyConcur 所需的。
要使用 Concur 的 API,您必须检索一个访问令牌。您可以选择以下 OAuth 策略之一来获取并存储一个访问令牌
var client = ConcurClient(consumerKey: "CONSUMER_KEY", consumerSecret: "CONSUMER_SECRET")
client.getNativeFlowAccessToken("USERNAME", password: "PASSWORD", callback: { (error, token) in
if error != nil {
// Handle error
} else {
// Do something with ConcurAccessToken
}
})
要向 Concur 的 API 发送请求,您的 ConcurClient 必须包含一个访问令牌。
client.setAccessToken(token)
var token = functionThatLoadsConcurAccessToken()
var client = ConcurClient(consumerKey: "CONSUMER_KEY", consumerSecret: "CONSUMER_SECRET", accessToken: token)
var token = ConcurAccessToken(accessTokenString: functionThatLoadsAccessTokenString())
一旦初始化了客户端,就可以向 API 发送请求。
如果您需要刷新访问令牌并获取新的令牌,您必须有一个包含刷新令牌的 ConcurAccessToken 的 ConcurClient
client.refreshToken({ (error, token) in
if error != nil {
// Handle error
} else {
// Do something with ConcurAccessToken
}
})
这将使您的上一个访问令牌失效。
请参阅 LICENSE 文件。
var options : [String : AnyObject?] = [
"Parameters" : [
"offset" : "string", // Optional
"limit" : "int" // Optional
]
]
client.attendeeTypesGet(options, callback: { (error, returnValue) in
if error == nil {
// returnValue is of type ConcurCollection<AttendeeType>!
} else {
// error is of type String!
}
})
var options : [String : AnyObject?] = [
"id" : "string" // Required
]
client.attendeeTypesGet(options, callback: { (error, returnValue) in
if error == nil {
// returnValue is of type ConcurCollection<AttendeeType>!
} else {
// error is of type String!
}
})
var options : [String : AnyObject?] = [
"id" : "string" // Required
]
client.attendeeTypesDelete(options, callback: { (error, returnValue) in
if error == nil {
// returnValue is of type ConcurCollection<AttendeeType>!
} else {
// error is of type String!
}
})
var options = [String : AnyObject?] = [
"Body" : [
"AllowAttendeeCountEditing" : "boolean", // Optional
"AllowManuallyEnteredAttendees" : "boolean", // Optional
"AttendeeFormID" : "string", // Required
"Code" : "string", // Required
"ConnectorID" : "string", // Optional
"DuplicateSearchFields" : [
"string", "string", "string" // Required
],
"Name" : "string" // Required
]
]
client.attendeeTypesPost(options, callback: { (error, returnValue) in
if error == nil {
// returnValue is of type ConcurCollection<AttendeeType>!
} else {
// error is of type String!
}
})
var options = [String : AnyObject?] = [
"id" : "string", // Required
"Body" : [
"AllowAttendeeCountEditing" : "boolean", // Optional
"AllowManuallyEnteredAttendees" : "boolean", // Optional
"AttendeeFormID" : "string", // Optional
"Code" : "string", // Optional
"ConnectorID" : "string", // Optional
"DuplicateSearchFields" : [
"string", "string", "string" // Optional
],
"Name" : "string" // Required
]
]
client.attendeeTypesPut(options, callback: { (error, returnValue) in
if error == nil {
// returnValue is of type ConcurCollection<AttendeeType>!
} else {
// error is of type String!
}
})
var options : [String : AnyObject?] = [
"Parameters" : [
"offset" : "string", // Optional
"limit" : "int", // Optional
"status" : "string" // Optional
]
]
client.connectionRequestsGet(options, callback: { (error, returnValue) in
if error == nil {
// returnValue is of type ConcurCollection<ConnectionRequest>!
} else {
// error is of type String!
}
})
var options : [String : AnyObject?] = [
"id" : "string" // Required
]
client.connectionRequestsGet(options, callback: { (error, returnValue) in
if error == nil {
// returnValue is of type ConcurCollection<ConnectionRequest>!
} else {
// error is of type String!
}
})
var options : [String : AnyObject?] = [
"Parameters" : [
"user" : "string" // Required
]
]
client.connectionRequestsPost(options, callback: { (error, returnValue) in
if error == nil {
// returnValue is of type ConcurCollection<ConnectionRequest>!
} else {
// error is of type String!
}
})
var options : [String : AnyObject?] = [
"id" : "string", // Required
"Body" : [
"Status" : "string" // Required
]
]
client.connectionRequestsPut(options, callback: { (error, returnValue) in
if error == nil {
// returnValue is of type ConcurCollection<ConnectionRequest>!
} else {
// error is of type String!
}
})
var options : [String : AnyObject?] = [
"id" : "string" // Required
]
client.connectionRequestsDelete(options, callback: { (error, returnValue) in
if error == nil {
// returnValue is of type ConcurCollection<ConnectionRequest>!
} else {
// error is of type String!
}
})
var options : [String : AnyObject?] = [
"Parameters" : [
"reportID" : "string", // Optional
"paymentTypeID" : "string", // Optional
"batchID" : "string", // Optional
"isBillable" : "boolean", // Optional
"attendeeTypeCode" : "string", // Optional
"hasAttendees" : "boolean", // Optional
"hasVAT" : "boolean", // Optional
"expenseTypeCode" : "string", // Optional
"attendeeID" : "string", // Optional
"offset" : "string", // Optional
"limit" : "int", // Optional
"user" : "boolean" // Optional
]
]
client.entriesGet(options, callback: { (error, returnValue) in
if error == nil {
// returnValue is of type ConcurCollection<Entry>!
} else {
// error is of type String!
}
})
var options : [String : AnyObject?] = [
"id" : "string", // Required
"Parameters" : [
"user" : "string" // Optional
]
]
client.entriesGet(options, callback: { (error, returnValue) in
if error == nil {
// returnValue is of type ConcurCollection<Entry>!
} else {
// error is of type String!
}
})
var options : [String : AnyObject?] = [
"Body" : [
"Comment" : "string", // Optional
"Custom1" : "string", // Optional
"Custom2" : "string", // Optional
"Custom3" : "string", // Optional
"Custom4" : "string", // Optional
"Custom5" : "string", // Optional
"Custom6" : "string", // Optional
"Custom7" : "string", // Optional
"Custom8" : "string", // Optional
"Custom9" : "string", // Optional
"Custom10" : "string", // Optional
"Custom11" : "string", // Optional
"Custom12" : "string", // Optional
"Custom13" : "string", // Optional
"Custom14" : "string", // Optional
"Custom15" : "string", // Optional
"Custom16" : "string", // Optional
"Custom17" : "string", // Optional
"Custom18" : "string", // Optional
"Custom19" : "string", // Optional
"Custom20" : "string", // Optional
"Custom21" : "string", // Optional
"Custom22" : "string", // Optional
"Custom23" : "string", // Optional
"Custom24" : "string", // Optional
"Custom25" : "string", // Optional
"Custom26" : "string", // Optional
"Custom27" : "string", // Optional
"Custom28" : "string", // Optional
"Custom29" : "string", // Optional
"Custom30" : "string", // Optional
"Custom31" : "string", // Optional
"Custom32" : "string", // Optional
"Custom33" : "string", // Optional
"Custom34" : "string", // Optional
"Custom35" : "string", // Optional
"Custom36" : "string", // Optional
"Custom37" : "string", // Optional
"Custom38" : "string", // Optional
"Custom39" : "string", // Optional
"Custom40" : "string", // Optional
"Description" : "string", // Optional
"ExchangeRate" : "double", // Optional
"ExpenseTypeCode" : "string", // Required
"IsBillable" : "boolean", // Optional
"IsPersonal" : "boolean", // Optional
"Journey" : [ // Optional
"BusinessDistance" : "int", // Optional
"EndLocation" : "string", // Required
"NumberOfPassengers" : "int", // Optional
"OdometerEnd" : "int", // Optional
"OdometerStart" : "int", // Optional
"PersonalDistance" : "int", // Optional
"StartLocation" : "string", // Required
"UnitOfMeasure" : "string", // Required
"VehicleID" : "string" // Optional
],
"LocationID" : "string", // Optional
"OrgUnit1" : "string", // Optional
"OrgUnit2" : "string", // Optional
"OrgUnit3" : "string", // Optional
"OrgUnit4" : "string", // Optional
"OrgUnit5" : "string", // Optional
"OrgUnit6" : "string", // Optional
"PaymentTypeID" : "string", // Optional
"ReportID" : "string", // Required
"TaxReceiptType" : "string", // Optional
"TransactionAmount" : "double", // Optional
"TransactionCurrencyCode" : "string", // Optional
"TransactionDate" : "datetime", // Required
"VendorDescription" : "string", // Optional
"VendorListItemID" : "string" // Optional
],
"Parameters" : [
"user" : "string" // Optional
]
]
client.entriesPost(options, callback: { (error, returnValue) in
if error == nil {
// returnValue is of type ConcurCollection<Entry>!
} else {
// error is of type String!
}
})
var options : [String : AnyObject?] = [
"id" : "string", // Required
"Body" : [
"Comment" : "string", // Optional
"Custom1" : "string", // Optional
"Custom2" : "string", // Optional
"Custom3" : "string", // Optional
"Custom4" : "string", // Optional
"Custom5" : "string", // Optional
"Custom6" : "string", // Optional
"Custom7" : "string", // Optional
"Custom8" : "string", // Optional
"Custom9" : "string", // Optional
"Custom10" : "string", // Optional
"Custom11" : "string", // Optional
"Custom12" : "string", // Optional
"Custom13" : "string", // Optional
"Custom14" : "string", // Optional
"Custom15" : "string", // Optional
"Custom16" : "string", // Optional
"Custom17" : "string", // Optional
"Custom18" : "string", // Optional
"Custom19" : "string", // Optional
"Custom20" : "string", // Optional
"Custom21" : "string", // Optional
"Custom22" : "string", // Optional
"Custom23" : "string", // Optional
"Custom24" : "string", // Optional
"Custom25" : "string", // Optional
"Custom26" : "string", // Optional
"Custom27" : "string", // Optional
"Custom28" : "string", // Optional
"Custom29" : "string", // Optional
"Custom30" : "string", // Optional
"Custom31" : "string", // Optional
"Custom32" : "string", // Optional
"Custom33" : "string", // Optional
"Custom34" : "string", // Optional
"Custom35" : "string", // Optional
"Custom36" : "string", // Optional
"Custom37" : "string", // Optional
"Custom38" : "string", // Optional
"Custom39" : "string", // Optional
"Custom40" : "string", // Optional
"Description" : "string", // Optional
"ExchangeRate" : "double", // Optional
"ExpenseTypeCode" : "string", // Optional
"IsBillable" : "boolean", // Optional
"IsPersonal" : "boolean", // Optional
"Journey" : [ // Optional
"BusinessDistance" : "int", // Optional
"EndLocation" : "string", // Optional
"NumberOfPassengers" : "int", // Optional
"OdometerEnd" : "int", // Optional
"OdometerStart" : "int", // Optional
"PersonalDistance" : "int", // Optional
"StartLocation" : "string", // Optional
"UnitOfMeasure" : "string", // Optional
"VehicleID" : "string" // Optional
],
"LocationID" : "string", // Optional
"OrgUnit1" : "string", // Optional
"OrgUnit2" : "string", // Optional
"OrgUnit3" : "string", // Optional
"OrgUnit4" : "string", // Optional
"OrgUnit5" : "string", // Optional
"OrgUnit6" : "string", // Optional
"PaymentTypeID" : "string", // Optional
"ReportID" : "string", // Optional
"TaxReceiptType" : "string", // Optional
"TransactionAmount" : "double", // Optional
"TransactionCurrencyCode" : "string", // Optional
"TransactionDate" : "datetime", // Optional
"VendorDescription" : "string", // Optional
"VendorListItemID" : "string" // Optional
],
"Parameters" : [
"user" : "string" // Optional
]
]
client.entriesPut(options, callback: { (error, returnValue) in
if error == nil {
// returnValue is of type ConcurCollection<Entry>!
} else {
// error is of type String!
}
})
var options : [String : AnyObject?] = [
"id" : "string", // Required
"Parameters" : [
"user" : "string" // Optional
]
]
client.entriesDelete(options, callback: { (error, returnValue) in
if error == nil {
// returnValue is of type ConcurCollection<Entry>!
} else {
// error is of type String!
}
})
var options : [String : AnyObject?] = [
"Parameters" : [
"entryID" : "string", // Optional
"offset" : "string", // Optional
"limit" : "int", // Optional
"user" : "string" // Optional
]
]
client.entryAttendeeAssociationsGet(options, callback: { (error, returnValue) in
if error == nil {
// returnValue is of type ConcurCollection<EntryAttendeeAssociation>!
} else {
// error is of type String!
}
})
var options : [String : AnyObject?] = [
"id" : "string", // Required
"Parameters" : [
"user" : "string" // Optional
]
]
client.entryAttendeeAssociationsGet(options, callback: { (error, returnValue) in
if error == nil {
// returnValue is of type ConcurCollection<EntryAttendeeAssociation>!
} else {
// error is of type String!
}
})
var options : [String : AnyObject?] = [
"Body" : [
"Amount" : "double", // Optional
"AssociatedAttendeeCount" : "int", // Optional
"AttendeeID" : "string", // Required
"Custom1" : "string", // Optional
"Custom2" : "string", // Optional
"Custom3" : "string", // Optional
"Custom4" : "string", // Optional
"Custom5" : "string", // Optional
"EntryID" : "string" // Required
],
"Parameters" : [
"user" : "string" // Optional
]
]
client.entryAttendeeAssociationsPost(options, callback: { (error, returnValue) in
if error == nil {
// returnValue is of type ConcurCollection<EntryAttendeeAssociation>!
} else {
// error is of type String!
}
var options : [String : AnyObject?] = [
"id" : "string", // Required
"Body" : [
"Amount" : "double", // Optional
"AssociatedAttendeeCount" : "int", // Optional
"AttendeeID" : "string", // Optional
"Custom1" : "string", // Optional
"Custom2" : "string", // Optional
"Custom3" : "string", // Optional
"Custom4" : "string", // Optional
"Custom5" : "string", // Optional
"EntryID" : "string" // Optional
],
"Parameters" : [
"user" : "string" // Optional
]
]
client.entryAttendeeAssociationsPut(options, callback: { (error, returnValue) in
if error == nil {
// returnValue is of type ConcurCollection<EntryAttendeeAssociation>!
} else {
// error is of type String!
}
})
var options : [String : AnyObject?] = [
"id" : "string", // Required
"Parameters" : [
"user" : "string" // Optional
]
]
client.entryAttendeeAssociationsDelete(options, callback: { (error, returnValue) in
if error == nil {
// returnValue is of type ConcurCollection<EntryAttendeeAssociation>!
} else {
// error is of type String!
}
})
var options : [String : AnyObject?] = [
"Parameters" : [
"user" : "string", // Optional
"offset" : "string", // Optional
"limit" : "int" // Optional
]
]
client.expenseGroupConfigurationsGet(options, callback: { (error, returnValue) in
if error == nil {
// returnValue is of type ConcurCollection<ExpenseGroupConfiguration>!
} else {
// error is of type String!
}
})
var options : [String : AnyObject?] = [
"id" : "string", // Required
"Parameters" : [
"user" : "string" // Optional
]
]
client.expenseGroupConfigurationsGet(options, callback: { (error, returnValue) in
if error == nil {
// returnValue is of type ConcurCollection<ExpenseGroupConfiguration>!
} else {
// error is of type String!
}
})
var options : [String : AnyObject?] = [
"Parameters" : [
"offset" : "string", // Optional
"limit" : "int", // Optional
"user" : "string" // Optional
]
]
client.quickExpensesGet(options, callback: { (error, returnValue) in
if error == nil {
// returnValue is of type ConcurCollection<QuickExpense>!
} else {
// error is of type String!
}
})
var options : [String : AnyObject?] = [
"id" : "string", // Required
"Parameters" : [
"user" : "string" // Optional
]
]
client.quickExpensesGet(options, callback: { (error, returnValue) in
if error == nil {
// returnValue is of type ConcurCollection<QuickExpense>!
} else {
// error is of type String!
}
})
var options : [String : AnyObject?] = [
"Body" : [
"Comment" : "string", // Optional
"CurrencyCode" : "string", // Required
"ExpenseTypeCode" : "string", // Optional
"LocationCity" : "string", // Optional
"LocationCountry" : "string", // Optional
"LocationSubdivision" : "string", // Optional
"PaymentTypeCode" : "string", // Optional
"ReceiptImageID" : "string", // Optional
"SpendCategoryCode" : "string", // Optional
"TransactionAmount" : "double", // Required
"TransactionDate" : "datetime", // Required
"VendorDescription" : "string" // Optional
],
"Parameters" : [
"user" : "string" // Optional
]
]
client.quickExpensesPost(options, callback: { (error, returnValue) in
if error == nil {
// returnValue is of type ConcurCollection<QuickExpense>!
} else {
// error is of type String!
}
})
var options : [String : AnyObject?] = [
"id" : "string", // Required
"Body" : [
"Comment" : "string", // Optional
"CurrencyCode" : "string", // Optional
"ExpenseTypeCode" : "string", // Optional
"LocationCity" : "string", // Optional
"LocationCountry" : "string", // Optional
"LocationSubdivision" : "string", // Optional
"PaymentTypeCode" : "string", // Optional
"ReceiptImageID" : "string", // Optional
"SpendCategoryCode" : "string", // Optional
"TransactionAmount" : "double", // Optional
"TransactionDate" : "datetime", // Optional
"VendorDescription" : "string" // Optional
],
"Parameters" : [
"user" : "string" // Optional
]
]
client.quickExpensesPut(options, callback: { (error, returnValue) in
if error == nil {
// returnValue is of type ConcurCollection<QuickExpense>!
} else {
// error is of type String!
}
})
var options : [String : AnyObject?] = [
"id" : "string", // Required
"Parameters" : [
"user" : "string" // Optional
]
]
client.quickExpensesDelete(options, callback: { (error, returnValue) in
if error == nil {
// returnValue is of type ConcurCollection<QuickExpense>!
} else {
// error is of type String!
}
})