Advertisement
Guest User

Untitled

a guest
Dec 2nd, 2016
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. /**
  2. * Could eventually be added to TSD, or to jsforce package root...
  3. */
  4.  
  5. declare module "jsforce" {
  6. class Connection {
  7. constructor({ loginUrl: string});
  8.  
  9. login(username: string, password: string, callback: (err: Error, userInfo: UserInfo) => void);
  10.  
  11. sobject(type: 'Account'): SObject<Account>;
  12. }
  13.  
  14. interface UserInfo {
  15. id: string;
  16. organizationId: string;
  17. url: string;
  18. }
  19.  
  20. interface SObject<T> {
  21. retrieve(id: string, callback: (err: Error, ret: T & ResponseExtra) => void);
  22. retrieve(id: string[], callback: (err: Error, ret: (T & ResponseExtra)[]) => void);
  23.  
  24. upsert(record: any, extIdField: string, callback: (err: Error, ret: any) => void);
  25. }
  26.  
  27. interface Account {
  28. Id: string;
  29. Name: string;
  30. // ...
  31. }
  32.  
  33. interface ResponseExtra {
  34. attributes: Attributes;
  35. }
  36.  
  37. interface Attributes {
  38. type: string;
  39. url: string;
  40. }
  41.  
  42. export {
  43. Connection,
  44. }
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement