การใช้งานในการค้นหา
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
การดึงข้อมูลอ้างอิงไปยังคลาส Proto เมื่อใช้ API กำหนดให้คุณต้อง
มีความเข้าใจโดยธรรมชาติเกี่ยวกับ API หรือต้องค้นหา
เอกสารอ้างอิง Proto บ่อยๆ เพื่อดูเส้นทางที่แน่นอน
ProtoLookupUtil
เครื่องมือค้นหา Proto ช่วยให้คุณค้นหาและสร้างอินสแตนซ์ของบริการ
การดำเนินการ การแจงนับ และทรัพยากรได้โดยไม่ต้องติดตามหมายเลขเวอร์ชันและเนมสเปซของ API
โดยปกติแล้ว คุณจะสร้างอินสแตนซ์ของแคมเปญได้ดังนี้
campaign = Google::Ads::GoogleAds::V21::Resources::Campaign.new
แต่เมื่อใช้เครื่องมือค้นหาโปรโตคอล คุณจะใช้รูปแบบที่ง่ายกว่าได้ ดังนี้
campaign = client.resource.campaign
เมื่อดึงข้อมูลทรัพยากร บริการ หรือการดำเนินการ ระบบจะแสดงอินสแตนซ์ของเอนทิตีนั้น เมื่อดึงข้อมูลการแจงนับ ระบบจะแสดงผลการอ้างอิงไปยังคลาส
โดยไม่ต้องสร้างอินสแตนซ์
สำหรับการแจงนับ คุณสามารถใช้ทางลัดเพื่อข้ามการค้นหาโปรโตคอลการแจงนับได้
campaign.status = :PAUSED
เราขอแนะนำให้ใช้วิธี client.service
เพื่อดึงข้อมูลบริการ แม้ว่าคุณจะไม่ได้ใช้ยูทิลิตี้นี้สำหรับกรณีการใช้งานอื่นๆ ก็ตาม วิธีนี้มีตรรกะเพิ่มเติมในตัวเพื่อส่งต่อโทเค็นนักพัฒนาแอปและรายละเอียดการตรวจสอบสิทธิ์ ซึ่งคุณจะต้องจัดการด้วยตนเองหากใช้วิธีอื่น
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-09-05 UTC
[null,null,["อัปเดตล่าสุด 2025-09-05 UTC"],[[["\u003cp\u003eThe ProtoLookupUtil simplifies interactions with the Google Ads API by removing the need to specify API version numbers and namespaces when working with services, operations, enumerations, and resources.\u003c/p\u003e\n"],["\u003cp\u003eInstead of manually instantiating proto classes with complex paths, the utility allows you to create and access them using a more concise and intuitive syntax, such as \u003ccode\u003eclient.resource.campaign\u003c/code\u003e instead of \u003ccode\u003eGoogle::Ads::GoogleAds::V18::Resources::Campaign.new\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eIt offers a shortcut for using enumerations directly, like assigning \u003ccode\u003e:PAUSED\u003c/code\u003e to a campaign status, without requiring explicit proto lookups.\u003c/p\u003e\n"],["\u003cp\u003eUsing \u003ccode\u003eclient.service\u003c/code\u003e is recommended for fetching services, as it automatically handles developer token and authentication details.\u003c/p\u003e\n"]]],[],null,["# Lookup Util\n\nFetching references to proto classes when using the API requires that you either\nhave an intrinsic understanding of the API or need to frequently look up the\nproto reference documentation for the exact path.\n\nProtoLookupUtil\n---------------\n\nThe proto lookup util lets you look up and create instances of services,\noperations, enumerations, and resources without having to keep track of API\nversion numbers and namespaces.\n\nHere's how you typically instantiate a campaign: \n\n campaign = Google::Ads::GoogleAds::V21::Resources::Campaign.new\n\nBut with the proto lookup util, you can use a simpler form: \n\n campaign = client.resource.campaign\n\nWhen fetching a resource, service, or operation, an instance of that entity is\nreturned. When fetching an enumeration, a reference to the class is returned,\nwithout instantiation.\n\nFor enumerations, you can use a shortcut to bypass the need for looking up the\nenumeration protos. \n\n campaign.status = :PAUSED\n\nWe recommend using the `client.service` method to fetch services even if you\ndon't use this utility for any other use cases. There is extra logic built into\nthis method to pass along your developer token and authentication details, which\nyou would have to handle manually if you used another method."]]