mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-09-09 11:13:57 +08:00
Add Stamplay js Sdk definitions
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
/// <reference path="stamplay-js-sdk.d.ts" />
|
||||
|
||||
var userFn = Stamplay.User();
|
||||
var user = new userFn.Model;
|
||||
|
||||
var tags = new Stamplay.Cobject('tag').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 fooMod = new Stamplay.Cobject('foo').Model;
|
||||
fooMod.fetch(5).then(
|
||||
function(){
|
||||
return fooMod.upVote()
|
||||
}
|
||||
).then(
|
||||
function(){
|
||||
//success callback
|
||||
}, function( err ){
|
||||
//error callback
|
||||
}
|
||||
)
|
||||
Vendored
+40
@@ -0,0 +1,40 @@
|
||||
// Type definitions for stamplay-js-sdk 1.2.9
|
||||
// Project: https://github.com/Stamplay/stamplay-js-sdk and https://stamplay.com/docs/jssdk#api-ref-model
|
||||
// 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)
|
||||
set(property : string, value: any)
|
||||
unset(property : string)
|
||||
fetch(id : any)
|
||||
destroy() : PromisesAPlus.Thenable<any>
|
||||
save({}?) : PromisesAPlus.Thenable<any>
|
||||
}
|
||||
|
||||
export interface IStamplayAction {
|
||||
new() : IStamplayModel
|
||||
upVote() : PromisesAPlus.Thenable<any>
|
||||
}
|
||||
|
||||
export interface IStamplayUser {
|
||||
Model : IStamplayModel
|
||||
}
|
||||
|
||||
export interface StamplayStatic {
|
||||
User() : IStamplayUser
|
||||
Cobject(collection : string) : void
|
||||
}
|
||||
}
|
||||
|
||||
declare var Stamplay: Stamplay.StamplayStatic;
|
||||
|
||||
declare module "Stamplay" {
|
||||
export = Stamplay;
|
||||
}
|
||||
Reference in New Issue
Block a user