ব্র্যান্ড পরিচালনা করুন, ব্র্যান্ড পরিচালনা করুন

সমস্ত এজেন্ট একটি ব্র্যান্ডের (ব্যবসা, সংস্থা বা গোষ্ঠী) অন্তর্গত। একটি এজেন্ট তৈরি করার আগে, একটি মালিকানাধীন ব্র্যান্ড তৈরি করা প্রয়োজন৷ ব্র্যান্ডগুলি আপনাকে একত্রে সম্পর্কিত এজেন্টদের গ্রুপ করতে সহায়তা করার জন্য সম্পূর্ণরূপে সাংগঠনিক।

এই পৃষ্ঠার কোড স্নিপেটগুলি জাভা নমুনা এবং Node.js নমুনা থেকে নেওয়া হয়েছে।

একটি ব্র্যান্ড তৈরি করুন

আপনি একটি নতুন ব্র্যান্ড তৈরি করতে পারেন। আরো বিস্তারিত জানার জন্য, brands এবং brands.create দেখুন।

Node.js

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);
});

Java.js

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 দেখুন।

Node.js

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 দেখুন।

Node.js

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 অপারেশন ব্যবহার করে ব্র্যান্ডের প্রদর্শনের নাম পরিবর্তন করা যেতে পারে:

Node.js

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'
}