আপনার ক্রেতা অ্যাকাউন্ট এবং আপনার যেকোনো ক্লায়েন্টের জন্য বিদ্যমান প্রস্তাবনাগুলো সম্পাদনা করতে আপনি নিম্নলিখিত পদ্ধতিগুলো ব্যবহার করতে পারেন।
প্যাচ
আপনি buyers.proposals.patch মেথডটি ব্যবহার করে একটি নির্দিষ্ট প্রপোজাল আপডেট করতে পারেন।
আলোচনা চলাকালীন কোনো প্রস্তাবে পরিবর্তন আনতে, অথবা চূড়ান্ত হওয়া কোনো প্রস্তাব নিয়ে পুনঃআলোচনা শুরু করতে আপনি এই পদ্ধতিটি ব্যবহার করতে পারেন।
আপনি patch দিয়ে প্রস্তাবের অবস্থা পরিবর্তন করতে পারবেন না।
একটি প্রস্তাব পরিবর্তন করার আরও উপায় জানতে নিম্নলিখিতগুলি দেখুন:
নিম্নলিখিত নমুনাটি দেখায় যে আপনি কীভাবে patch পদ্ধতি ব্যবহার করে একটি প্রস্তাবনা আপডেট করতে পারেন।
বিশ্রাম
অনুরোধ
PATCH https://authorizedbuyersmarketplace.googleapis.com/v1/buyers/12345678/proposals/MP49876074?updateMask=buyerPrivateData.referenceId&alt=json
Authorization: Bearer ACCESS_TOKEN
Content-Type: application/json
{
"proposalRevision": "1",
"buyerPrivateData": {
"referenceId": "2f5e9550-8d22-495e-ba38-9b9496347a3b"
}
}প্রতিক্রিয়া
{
"name": "buyers/12345678/proposals/MP49876074",
"updateTime": "2022-03-26T04:03:19.282Z",
"proposalRevision": "2",
"dealType": "PROGRAMMATIC_GUARANTEED",
"displayName": "Test PG Proposal #0ce643e9-5518-4e8e-b352-0cb45cc2eeb2",
"state": "SELLER_REVIEW_REQUESTED",
"originatorRole": "BUYER",
"publisherProfile": "buyers/12345678/publisherProfiles/PP111111",
"buyer": "buyers/12345678",
"buyerPrivateData": {
"referenceId": "2f5e9550-8d22-495e-ba38-9b9496347a3b"
},
"billedBuyer": "buyers/12345678",
"sellerContacts": [
{
"email": "jeff@hypersonicmedia.com"
},
{
"email": "alex@hypersonicmedia.com"
},
],
"buyerContacts": [
{
"email": "testemail89319783@test.com",
"displayName": "Joe"
}
],
"lastUpdaterOrCommentorRole": "BUYER",
"notes": [
{
"createTime": "2022-03-26T04:03:19.548Z",
"creatorRole": "BUYER",
"note": "Test programmatic guaranteed deal proposal."
}
]
}জাভা
/* * Copyright 2022 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.google.api.services.samples.authorizedbuyers.marketplace.v1.buyers.proposals; import com.google.api.services.authorizedbuyersmarketplace.v1.AuthorizedBuyersMarketplace; import com.google.api.services.authorizedbuyersmarketplace.v1.model.PrivateData; import com.google.api.services.authorizedbuyersmarketplace.v1.model.Proposal; import com.google.api.services.samples.authorizedbuyers.marketplace.v1.Utils; import java.io.IOException; import java.security.GeneralSecurityException; import java.util.UUID; import net.sourceforge.argparse4j.ArgumentParsers; import net.sourceforge.argparse4j.inf.ArgumentParser; import net.sourceforge.argparse4j.inf.ArgumentParserException; import net.sourceforge.argparse4j.inf.Namespace; /** * Patches a specified proposal at the given revision number. * * <p>Fields that can be patched for this resource can be found in the reference documentation: * https://developers.google.com/authorized-buyers/apis/marketplace/reference/rest/v1/buyers.proposals * * <p>Note: If the revision number is lower than what is stored for the proposal server-side, the * operation will be deemed obsolete and an error will be returned. * * <p>Only proposals for preferred and programmatic guaranteed deals can be modified by buyers. */ public class PatchProposals { public static void execute(AuthorizedBuyersMarketplace marketplaceClient, Namespace parsedArgs) { Long accountId = parsedArgs.getLong("account_id"); String proposalId = parsedArgs.getString(("proposal_id")); String name = String.format("buyers/%d/proposals/%s", accountId, proposalId); Long proposalRevision = parsedArgs.getLong("proposal_revision"); PrivateData buyerPrivateData = new PrivateData(); buyerPrivateData.setReferenceId( String.format("Marketplace-Java-Sample-Reference-%s", UUID.randomUUID())); Proposal patchedProposal = new Proposal(); patchedProposal.setProposalRevision(proposalRevision); patchedProposal.setBuyerPrivateData(buyerPrivateData); String updateMask = "buyerPrivateData.referenceId"; Proposal proposal = null; try { proposal = marketplaceClient .buyers() .proposals() .patch(name, patchedProposal) .setUpdateMask(updateMask) .execute(); } catch (IOException ex) { System.out.printf("Marketplace API returned error response:%n%s", ex); System.exit(1); } System.out.printf("Patching proposal with name \"%s\":%n", name); Utils.printProposal(proposal); } public static void main(String[] args) { ArgumentParser parser = ArgumentParsers.newFor("PatchProposals") .build() .defaultHelp(true) .description(("Patches a proposal at the given revision number.")); parser .addArgument("-a", "--account_id") .help( "The resource ID of the buyers resource for which the RFP is being patched. This " + "will be used to construct the name used as a path parameter for the " + "proposals.patch request.") .required(true) .type(Long.class); parser .addArgument("-p", "--proposal_id") .help( "The resource ID of the proposals resource that is being patched. This will be used to" + " construct the name used as a path parameter for the proposals.patch request.") .required(true) .type(String.class); parser .addArgument("-r", "--proposal_revision") .help( "The revision number for the proposal being modified. Each update to the proposal " + "or its deals causes the number to increment. The revision number specified must " + "match the value stored server-side in order for the operation to be performed.") .required(true) .type(Long.class); Namespace parsedArgs = null; try { parsedArgs = parser.parseArgs(args); } catch (ArgumentParserException ex) { parser.handleError(ex); System.exit(1); } AuthorizedBuyersMarketplace client = null; try { client = Utils.getMarketplaceClient(); } catch (IOException ex) { System.out.printf("Unable to create Marketplace API service:%n%s", ex); System.out.println("Did you specify a valid path to a service account key file?"); System.exit(1); } catch (GeneralSecurityException ex) { System.out.printf("Unable to establish secure HttpTransport:%n%s", ex); System.exit(1); } execute(client, parsedArgs); } }
একটি নোট যোগ করুন
কোনো প্রস্তাবে টীকা যোগ করতে আপনি buyers.proposals.addNote ব্যবহার করতে পারেন।
আপনি যখন কোনো প্রস্তাবে নোট যোগ করেন, তখন সেগুলি প্রস্তাবটির notes ফিল্ডে সংরক্ষিত হয়। নোটগুলি প্রকাশকের কাছে দৃশ্যমান থাকে। আলোচনার সময় প্রকাশকের সাথে যোগাযোগের জন্য আমরা notes ফিল্ডটি ব্যবহার করার পরামর্শ দিই।
নিম্নলিখিত নমুনাটি দেখায় যে আপনি কীভাবে ` addNote পদ্ধতি ব্যবহার করে একটি প্রস্তাবে নোট যোগ করতে পারেন।
বিশ্রাম
অনুরোধ
POST https://authorizedbuyersmarketplace.googleapis.com/v1/buyers/12345678/proposals/MP49876074:addNote?alt=json
Authorization: Bearer ACCESS_TOKEN
Content-Type: application/json
{
"note": {
"note": "Test note."
}
}প্রতিক্রিয়া
{
"name": "buyers/12345678/proposals/MP49876074",
"updateTime": "2022-03-26T04:03:19.282Z",
"proposalRevision": "2",
"dealType": "PROGRAMMATIC_GUARANTEED",
"displayName": "Test PG Proposal #0ce643e9-5518-4e8e-b352-0cb45cc2eeb2",
"state": "SELLER_REVIEW_REQUESTED",
"originatorRole": "BUYER",
"publisherProfile": "buyers/12345678/publisherProfiles/PP111111",
"buyer": "buyers/12345678",
"buyerPrivateData": {
"referenceId": "2f5e9550-8d22-495e-ba38-9b9496347a3b"
},
"billedBuyer": "buyers/12345678",
"sellerContacts": [
{
"email": "jeff@hypersonicmedia.com"
},
{
"email": "alex@hypersonicmedia.com"
},
],
"buyerContacts": [
{
"email": "testemail89319783@test.com",
"displayName": "Joe"
}
],
"lastUpdaterOrCommentorRole": "BUYER",
"notes": [
{
"createTime": "2022-03-26T04:03:19.548Z",
"creatorRole": "BUYER",
"note": "Test programmatic guaranteed deal proposal."
},
{
"createTime": "2022-03-26T05:36:23.406Z",
"creatorRole": "BUYER",
"note": "Test note."
}
]
}জাভা
/* * Copyright 2022 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.google.api.services.samples.authorizedbuyers.marketplace.v1.buyers.proposals; import com.google.api.services.authorizedbuyersmarketplace.v1.AuthorizedBuyersMarketplace; import com.google.api.services.authorizedbuyersmarketplace.v1.model.AddNoteRequest; import com.google.api.services.authorizedbuyersmarketplace.v1.model.Note; import com.google.api.services.authorizedbuyersmarketplace.v1.model.Proposal; import com.google.api.services.samples.authorizedbuyers.marketplace.v1.Utils; import java.io.IOException; import java.security.GeneralSecurityException; import net.sourceforge.argparse4j.ArgumentParsers; import net.sourceforge.argparse4j.inf.ArgumentParser; import net.sourceforge.argparse4j.inf.ArgumentParserException; import net.sourceforge.argparse4j.inf.Namespace; /** Adds a note to a given proposal. */ public class AddNoteToProposals { public static void execute(AuthorizedBuyersMarketplace marketplaceClient, Namespace parsedArgs) { Long accountId = parsedArgs.getLong("account_id"); String proposalId = parsedArgs.getString(("proposal_id")); String proposalName = String.format("buyers/%d/proposals/%s", accountId, proposalId); String noteValue = parsedArgs.getString("note"); Note note = new Note(); note.setNote(noteValue); AddNoteRequest addNoteRequest = new AddNoteRequest(); addNoteRequest.setNote(note); Proposal proposal = null; try { proposal = marketplaceClient.buyers().proposals().addNote(proposalName, addNoteRequest).execute(); } catch (IOException ex) { System.out.printf("Marketplace API returned error response:%n%s", ex); System.exit(1); } System.out.printf("Adding note to proposal with name \"%s\":%n", proposalName); Utils.printProposal(proposal); } public static void main(String[] args) { ArgumentParser parser = ArgumentParsers.newFor("AddNoteToProposals") .build() .defaultHelp(true) .description(("Adds a note to a given proposal.")); parser .addArgument("-a", "--account_id") .help( "The resource ID of the buyers resource under which the proposal is being " + "accessed. This will be used to construct the proposal name used as a path " + "parameter for the proposals.addNote request.") .required(true) .type(Long.class); parser .addArgument("-p", "--proposal_id") .help( "The resource ID of the proposals resource that a note is being added to. This " + "will be used to construct the name used as a path parameter for the " + "proposals.addNote request.") .required(true) .type(String.class); parser .addArgument("-n", "--note") .help("The note to be added to the proposal.") .type(String.class) .setDefault("Created note from Java sample."); Namespace parsedArgs = null; try { parsedArgs = parser.parseArgs(args); } catch (ArgumentParserException ex) { parser.handleError(ex); System.exit(1); } AuthorizedBuyersMarketplace client = null; try { client = Utils.getMarketplaceClient(); } catch (IOException ex) { System.out.printf("Unable to create Marketplace API service:%n%s", ex); System.out.println("Did you specify a valid path to a service account key file?"); System.exit(1); } catch (GeneralSecurityException ex) { System.out.printf("Unable to establish secure HttpTransport:%n%s", ex); System.exit(1); } execute(client, parsedArgs); } }