সকল এজেন্ট একটি ব্র্যান্ডের (ব্যবসা, সংস্থা বা গোষ্ঠী) অন্তর্ভুক্ত। কোনো এজেন্ট তৈরি করার আগে, একটি মালিকানা ব্র্যান্ড তৈরি করা আবশ্যক। ব্র্যান্ডগুলো সম্পূর্ণরূপে সাংগঠনিক, যা আপনাকে সম্পর্কিত এজেন্টদের একত্রিত করতে সাহায্য করে।
এই পৃষ্ঠার কোড স্নিপেটগুলো জাভা স্যাম্পল এবং নোড.জেএস স্যাম্পল থেকে নেওয়া হয়েছে।
একটি ব্র্যান্ড তৈরি করুন
আপনি একটি নতুন ব্র্যান্ড তৈরি করতে পারেন। আরও বিস্তারিত জানতে brands এবং brands.create দেখুন।
cURL
curl -v -X POST "https://businesscommunications.googleapis.com/v1/brands" \ -H "Content-Type: application/json" \ -H "User-Agent: curl/business-messaging" \ -H "`oauth2l header --json rbm-developer-service-account-credentials.json businesscommunications`" \ -d "{ 'name': 'Test Brand', 'displayName': 'Test Brand' }"
নোড.জেএস
const businessCommunicationsApiHelper = require('@google/rbm-businesscommunications'); const privateKey = require('../../resources/businesscommunications-service-account-credentials.json'); businessCommunicationsApiHelper.initBusinessCommunucationsApi(privateKey); businessCommunicationsApiHelper.createBrand('My new brand').then((response) => { console.log('The new brand is:'); console.log(response.data); }).catch((err) => { console.log(err); });
জাভা
String displayName = flags.getOrDefault("brand_name", "Test brand: " + now.getSecond()); Brand brand = api.createBrand(displayName); logger.info("New brand id: " + brand.getName());
এই কোডটি নতুন ব্র্যান্ডের নাম ( displayName ) এবং ব্র্যান্ডটিকে বরাদ্দ করা একটি অনন্য শনাক্তকারী ( name ) ফেরত দেয়:
{
name: 'brands/17456b6b-65dc-4e35-b128-fd3047664ddf',
displayName: 'My new brand'
}
একটি ব্র্যান্ড পুনরুদ্ধার করুন
আপনি একটি ব্র্যান্ডের অনন্য শনাক্তকারী ( name ) ব্যবহার করে সেটির তথ্য পেতে পারেন। আরও বিস্তারিত জানতে brands.get দেখুন।
cURL
curl -v "https://businesscommunications.googleapis.com/v1/$BRAND_ID" \ -H "Content-Type: application/json" \ -H "User-Agent: curl/business-messaging" \ -H "`oauth2l header --json rbm-developer-service-account-credentials.json businesscommunications`"
নোড.জেএস
const businessCommunicationsApiHelper = require('@google/rbm-businesscommunications'); const privateKey = require('../../resources/businesscommunications-service-account-credentials.json'); businessCommunicationsApiHelper.initBusinessCommunucationsApi(privateKey); businessCommunicationsApiHelper.getBrand(brandId).then((response) => { console.log('Brand details are:'); console.log(response.data); }).catch((err) => { console.log(err); });
জাভা
Brand brand = api.getBrand(brandId); logger.info("Brand: " + brand);
এই কোডটি ব্র্যান্ডের তথ্য ফেরত দেয়:
{
name: 'brands/17456b6b-65dc-4e35-b128-fd3047664ddf',
displayName: 'My new brand'
}
ব্র্যান্ডগুলির তালিকা
আপনি আপনার তৈরি করা সমস্ত ব্র্যান্ডের একটি তালিকা পেতে পারেন। আরও বিস্তারিত জানতে brands.list দেখুন।
cURL
curl -v "https://businesscommunications.googleapis.com/v1/brands" \ -H "Content-Type: application/json" \ -H "User-Agent: curl/business-messaging" \ -H "`oauth2l header --json rbm-developer-service-account-credentials.json businesscommunications`"
নোড.জেএস
const businessCommunicationsApiHelper = require('@google/rbm-businesscommunications'); const privateKey = require('../../resources/businesscommunications-service-account-credentials.json'); businessCommunicationsApiHelper.initBusinessCommunucationsApi(privateKey); businessCommunicationsApiHelper.listBrands().then((response) => { console.log('Current brands available are:'); console.log(response.data); }).catch((err) => { console.log(err); });
জাভা
List<Brand> brands = api.listBrands().stream().sorted(Comparator.comparing(Brand::getName)) .collect(Collectors.toList()); logger.info(String.format("Found %d brands", brands.size())); for (Brand brand : brands) { logger.info(String.format("Brand [%s]: '%s'", brand.getName(), brand.getDisplayName())); }
এই কোডটি আপনার সমস্ত ব্র্যান্ডের একটি তালিকা ফেরত দেবে:
{
brands: [
{
name: 'brands/1deb6297-8a57-474a-a02c-48529a3de0a0',
displayName: 'My brand'
},
{
name: 'brands/3b607982-8c06-467a-96b8-020ddc26ac83',
displayName: 'My second brand'
},
{
name: 'brands/40bd963f-ff92-425c-b273-8f0892d2d017',
displayName: 'My thrd brand'
}
]
}
একটি ব্র্যান্ডের নাম পরিবর্তন করুন
আপনি ব্র্যান্ডের প্রদর্শিত নাম পরিবর্তন করতে পারেন। আরও বিস্তারিত জানতে brands.patch দেখুন।
patch অপারেশন ব্যবহার করে ব্র্যান্ডের প্রদর্শিত নাম পরিবর্তন করা যায়:
নোড.জেএস
const businessCommunicationsApiHelper = require('@google/rbm-businesscommunications'); const privateKey = require('../../resources/businesscommunications-service-account-credentials.json'); businessCommunicationsApiHelper.initBusinessCommunucationsApi(privateKey); businessCommunicationsApiHelper .patchBrand(brand.name, 'My brand new name').then((response) => { console.log(response.data); });
এই কোডটি হালনাগাদ করা ব্র্যান্ডের তথ্য ফেরত দেয়:
{
name: 'brands/40bd963f-ff92-425c-b273-8f0892d2d017',
displayName: 'My brands new name'
}