coincitymexico/coincity-sdk

v0.0.1 2021-11-01 18:26 UTC

This package is auto-updated.

Last update: 2024-10-29 06:25:17 UTC


README

Configure yours credentials

$token = "your token for sdk" 
$sdk = new Configuration();

// Set your token
$sdk->setToken($token);

// Disable SSL/HTTPS only for local use
$sdk->setSsl(false);

// Custom your website base endpoint 
$sdk->setWebsite("https://localhost/coincity/dash/api");

Available Models at the moment

use \Coincity\SDK\Fun; 

Fun\User::class;
Fun\Search::class;
Fun\SearchCookie::class;
Fun\Stock::class;
Fun\StockSync::class;
Fun\StockMovement::class;
Fun\Category::class;
Fun\SubCategory::class;
Fun\SubCategoryMachine::class;
Fun\Brands::class;
Fun\Model::class;

// ... wait for more

Users

Get users paginated

$page = 1;// optional
$r = User::getPaginated($page);

Get user by Identifier

$id = 1;
$r = User::findById($id);

New User

$user = new User();
$user->attributes->setName("Testing");
$user->attributes->setLastName("Now");
$user->attributes->setEmail("chulin@chulin.com");
$user->attributes->setEmailAlternative("probando@ando.com");
$user->attributes->setPassword("12345678");
$user->attributes->setPasswordConfirm("12345678");
$user->attributes->setCompany("OWL DESARROLLOS");
$result = $user->save();

Edit user

$user = new User();
$id = 123;
$user->attributes->setId($id);// this says if is new register or edit 
$user->attributes->setName("Testing");
$user->attributes->setLastName("Now");
$user->attributes->setEmail("chulin@chulin.com");
$user->attributes->setEmailAlternative("probando@ando.com");
$user->attributes->setPassword("12345678");
$user->attributes->setPasswordConfirm("12345678");
$user->attributes->setCompany("OWL DESARROLLOS");
$result = $user->save();

Delete user

$user = new User();
$id = 123;
$user->attributes->setId($id); 
$result = $user->drop();

Restore user

$user = new User();
$id = 123;
$user->attributes->setId($id);
$user->attributes->setRestoreThis(true); // this restore
$result = $user->save();

Stock

$stock = new StockSync();
$stock->attributes->setCveSae("PROBANDO ANDO");
$stock->attributes->setDown(1);
$stock = $stock->save();

My GitHub danidoble

Created by danidoble