সকল এজেন্ট একটি ব্র্যান্ডের (ব্যবসা, প্রতিষ্ঠান, অথবা গোষ্ঠী) অন্তর্গত। এজেন্ট তৈরি করার আগে, একটি নিজস্ব ব্র্যান্ড তৈরি করা প্রয়োজন। ব্র্যান্ডগুলি সম্পূর্ণরূপে সাংগঠনিক যা আপনাকে সম্পর্কিত এজেন্টদের একত্রিত করতে সাহায্য করে।
এই পৃষ্ঠার কোড স্নিপেটগুলি জাভা নমুনা এবং Node.js নমুনা থেকে নেওয়া হয়েছে।
একটি ব্র্যান্ড তৈরি করুন
আপনি একটি নতুন ব্র্যান্ড তৈরি করতে পারেন। আরও বিস্তারিত জানার জন্য, brands এবং brands.create দেখুন।
নোড.জেএস
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 দেখুন।
নোড.জেএস
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 দেখুন।
নোড.জেএস
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'
}