Skip to content

Instantly share code, notes, and snippets.

@lobot
lobot / help-center-mass-delete-cancel-yourdb-typescript
Created July 6, 2022 00:01
help-center-mass-delete-cancel-yourdb-typescript
const config: Configuration = new Configuration({
username: LOB_API_KEY,
});
const postcardsApi = new PostcardsApi(config);
for (let item of dbdata) {
await postcardsApi.cancel(item.id);
/* Remove the record from your database */
}
@lobot
lobot / help-center-mass-delete-create-yourdb-typescript
Created July 6, 2022 00:00
help-center-mass-delete-create-yourdb-typescript
const config: Configuration = new Configuration({
username: "test_XXXXXXXXX",
});
const postCardExample: PostcardEditable = {
to: {
name: "HARRY ZHANG",
address_line1: "210 KING STREET",
address_city: "SAN FRANCISCO",
address_state: "CA",
address_zip: "94107",
@lobot
lobot / help-center-mass-delete-cancel-typescript
Created July 5, 2022 23:59
help-center-mass-delete-cancel-typescript
const config: Configuration = new Configuration({
username: "test_XXXXXXXXX",
});
const postcardsApi = new PostcardsApi(config);
const listOfPostcards = await postcardsApi.list(
undefined,
undefined,
undefined,
undefined,
undefined,
@lobot
lobot / help-center-mass-delete-create-typescript
Created July 5, 2022 23:58
help-center-mass-delete-create-typescript
const config: Configuration = new Configuration({
username: "test_XXXXXXXXX",
});
const postCardExample: PostcardEditable = {
to: {
company: "HARRY ZHANG",
address_line1: "210 KING STREET",
address_city: "SAN FRANCISCO",
address_state: "CA",
{
"id": "psc_9303c02190b14023",
"description": "First Postcard",
"metadata": {},
"to": {
"id": "adr_db9d33f9264e44f7",
"description": null,
"name": "HARRY ZHANG",
"company": null,
"phone": null,
@lobot
lobot / qs-java-code
Last active September 30, 2022 07:34
package com.company.app;
import com.lob.api.ApiClient;
import com.lob.api.ApiException;
import com.lob.api.Configuration;
import com.lob.api.auth.*;
import com.lob.model.*;
import com.lob.api.client.PostcardsApi;
public class App
@lobot
lobot / qs-php-code
Created July 1, 2022 21:41
qs-php-code
<?php require __DIR__ . '/vendor/autoload.php';
$lob = new \Lob\Lob('<TEST_API_KEY');
$postcard = $lob->postcards()->create(array(
"description" => "First Postcard",
"to[name]" => "HARRY ZHANG",
"to[address_line1]" => "210 KING STREET",
"to[address_city]" => "SAN FRANCISCO",
"to[address_state]" => "CA",
require 'lob.rb'
require 'pp'
lob = Lob::Client.new(api_key: "<TEST_API_KEY>")
pp lob.postcards.create(
description: "First Postcard",
to: {
name: "Harry Zhang",
address_line1: "210 King Street",
@lobot
lobot / qs-python-code
Created July 1, 2022 21:38
qs-python-code
import lob
lob.api_key = "<YOUR_TEST_KEY>"
postcard = lob.Postcard.create(
description = "First Postcard",
to_address = {
"name": "Harry Zhang",
"address_line1": "210 King Street",
"address_city": "San Francisco",
@lobot
lobot / qs-ts-code
Created July 1, 2022 21:36
qs-ts-code
import {Configuration, Postcard, PostcardsApi, PostcardEditable, AddressEditable } from "@lob/lob-typescript-sdk"
async function demo() {
const config: Configuration = new Configuration({
username: "<YOUR_TEST_KEY>"
})
const postcardData : PostcardEditable = new PostcardEditable({
to: new AddressEditable({
name: "Harry Zhang",