mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-08-22 11:40:10 +08:00
Merge pull request #5958 from Ridermansb/master
Add Stamplay js Sdk definitions
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
/// <reference path="stamplay-js-sdk.d.ts" />
|
||||
|
||||
var userFn = Stamplay.User();
|
||||
var user = new userFn.Model;
|
||||
var colTags = Stamplay.Cobject('tag');
|
||||
var tags = new colTags.Collection();
|
||||
|
||||
// Signing up
|
||||
var registrationData = {
|
||||
email : 'user@provider.com',
|
||||
password: 'mySecret'
|
||||
};
|
||||
|
||||
user.signup(registrationData).then(function(){
|
||||
user.set('phoneNumber', '020 123 4567' );
|
||||
return user.save();
|
||||
}).then(function(){
|
||||
var number = user.get('phoneNumber');
|
||||
console.log(number); // number value is 020 123 4567
|
||||
});
|
||||
|
||||
|
||||
// Action
|
||||
var colFoo = Stamplay.Cobject('foo');
|
||||
var fooMod = new colFoo.Model();
|
||||
fooMod.fetch(5).then(
|
||||
function(){
|
||||
return fooMod.upVote()
|
||||
}
|
||||
).then(
|
||||
function(){
|
||||
//success callback
|
||||
}, function( err : any ){
|
||||
//error callback
|
||||
}
|
||||
)
|
||||
Vendored
+38
@@ -0,0 +1,38 @@
|
||||
// Type definitions for stamplay-js-sdk 1.2.9
|
||||
// Project: https://github.com/Stamplay/stamplay-js-sdk
|
||||
// Definitions by: Riderman de Sousa Barbosa <https://github.com/ridermansb/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="..\promises-a-plus\promises-a-plus.d.ts"/>
|
||||
|
||||
declare module Stamplay {
|
||||
|
||||
export interface IStamplayModel {
|
||||
signup({}) : PromisesAPlus.Thenable<any>
|
||||
new() : IStamplayModel
|
||||
get(property : string) : any
|
||||
set(property : string, value: any) : void
|
||||
unset(property : string) : void
|
||||
fetch(id : any) : PromisesAPlus.Thenable<any>
|
||||
destroy() : PromisesAPlus.Thenable<any>
|
||||
save({}?) : PromisesAPlus.Thenable<any>
|
||||
upVote() : PromisesAPlus.Thenable<any>
|
||||
}
|
||||
|
||||
export interface IStamplayObject {
|
||||
Model : IStamplayModel
|
||||
Collection : any
|
||||
|
||||
}
|
||||
|
||||
export interface StamplayStatic {
|
||||
User() : IStamplayObject
|
||||
Cobject(object : string) : IStamplayObject
|
||||
}
|
||||
}
|
||||
|
||||
declare var Stamplay: Stamplay.StamplayStatic;
|
||||
|
||||
declare module "Stamplay" {
|
||||
export = Stamplay;
|
||||
}
|
||||
Reference in New Issue
Block a user