SwiftyConcur 0.1.1

SwiftyConcur 0.1.1

测试测试过
语言语言 SwiftSwift
许可证 Apache 2
发布最后发布2016年6月
SPM支持 SPM

Christopher TrudeauConner BrennickRichard Puckett 维护。



 
依赖于:
Alamofire~> 3.4
SwiftyJSON~> 2.3.1
 

  • Concur Concept Lab

SwiftyConcur

Concur APIs 的 Swift SDK。

设置

要开始使用 SwiftyConcur,您可以使用 CocoaPods 将其添加到项目中

platform :ios, '9.0'
use_frameworks!

pod 'SwiftyConcur'

测试

要运行 SwiftyConcur 的单元测试,打开 SwiftyConcuriOSExample 工作区并运行以下命令之一

  • 产品 -> 测试
  • CMD + U

获取对 Concur APIs 的访问权限

要获取对 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 必须包含一个访问令牌。

如果已经创建了 ConcurClient,可以使用上述 Oauth 流之一获取一个令牌,并将其添加到 ConcurClient 中
client.setAccessToken(token)
如果您有一个令牌并且正在创建新的 ConcurClient,您可以使用 ConcurAccessToken 对象初始化它
var token = functionThatLoadsConcurAccessToken()
var client = ConcurClient(consumerKey: "CONSUMER_KEY", consumerSecret: "CONSUMER_SECRET", accessToken: token)
您还可以使用访问令牌字符串创建一个 ConcurAccessToken,但这将限制 ConcurAccessToken 可用的一些功能
var token = ConcurAccessToken(accessTokenString: functionThatLoadsAccessTokenString())

一旦初始化了客户端,就可以向 API 发送请求。

刷新访问令牌

如果您需要刷新访问令牌并获取新的令牌,您必须有一个包含刷新令牌的 ConcurAccessToken 的 ConcurClient

client.refreshToken({ (error, token) in
  if error != nil {
    // Handle error
  } else {
    // Do something with ConcurAccessToken
  }
})

这将使您的上一个访问令牌失效。

许可证

请参阅 LICENSE 文件。


已实现端点

参加者类型

获取所有参加者类型 - Swagger

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!
  }
})

通过 ID 获取单个参加者类型 - Swagger

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!
  }
})

通过 ID 删除参加者类型 - Swagger

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!
  }
})

创建新的参加者类型 - Swagger

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!
  }
})

通过 ID 更新参加者类型

注意:体中的至少一个参数必须提供
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!
  }
})

连接请求

获取所有连接请求 - Swagger

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!
  }
})

通过 ID 获取连接请求 - Swagger

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!
  }
})

创建连接请求 - Swagger

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!
  }
})

通过 ID 更新连接请求 - Swagger

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!
  }
})

删除连接请求 - Swagger

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!
  }
})

条目

获取所有费用条目 - Swagger

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!
  }
})

通过 ID 获取单个费用条目 - Swagger

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!
  }
})

创建一个新的费用条目 - Swagger

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!
  }
})

根据ID更新费用条目 - Swagger

注意:必须在Body中提供至少一个参数
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!
  }
})

根据ID删除费用条目 - Swagger

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!
  }
})

EntryAttendeeAssociations

获取所有条目参与关系 - Swagger

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!
  }
})

根据ID获取单个条目参与关系 - Swagger

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!
  }
})

创建新的条目参与关系 - Swagger

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!
  }

根据ID更新条目参与关系 - Swagger

注意:必须在Body中提供至少一个参数
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!
  }
})

根据ID删除条目参与关系 - Swagger

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!
  }
})

ExpenseGroupConfigurations

获取费用组配置 - Swagger

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!
  }
})

根据ID获取费用组配置 - Swagger

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!
  }
})

QuickExpenses

获取所有快速费用 - Swagger

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!
  }
})

根据ID获取单个快速费用 - Swagger

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!
  }
})

创建一个新的快速消费 - Swagger

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!
  }
})

根据ID更新快速消费 - Swagger

注意:正文中的参数至少提供一个
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!
  }
})

根据ID删除快速消费 - Swagger

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!
  }
})