GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — api-client-python/docs/sdks/pins/README.md at main · gleanwork/api-client-python

Expand file tree

/

README.md

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
243 lines (167 loc) · 26.7 KB
/

README.md

Copy path

File metadata and controls

243 lines (167 loc) · 26.7 KB
Raw
Copy raw file
Download raw file
Outline
Edit and raw actions

Client.Pins

Overview

Available Operations

  • update - Update pin
  • retrieve - Read pin
  • list - List pins
  • create - Create pin
  • remove - Delete pin

update

Update an existing user-generated pin.

Example Usage

from glean.api_client import Glean, models
import os


with Glean(
    api_token=os.getenv("GLEAN_API_TOKEN"),
) as glean:

    res = glean.client.pins.update(audience_filters=[
        {
            "field_name": "type",
            "values": [
                {
                    "value": "Spreadsheet",
                    "relation_type": models.RelationType.EQUALS,
                },
                {
                    "value": "Presentation",
                    "relation_type": models.RelationType.EQUALS,
                },
            ],
        },
    ])

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
locale Optional[str] ➖ The client's preferred locale in rfc5646 format (e.g. en, ja, pt-BR). If omitted, the Accept-Language will be used. If not present or not supported, defaults to the closest match or en.
queries List[str] ➖ The query strings for which the pinned result will show.
audience_filters List[models.FacetFilter] ➖ Filters which restrict who should see the pinned document. Values are taken from the corresponding filters in people search.
id Optional[str] ➖ The opaque id of the pin to be edited.
retries Optional[utils.RetryConfig] ➖ Configuration to override the default retry behavior of the client.

Response

models.PinDocument

Errors

Error Type Status Code Content Type
errors.GleanError 4XX, 5XX */*

retrieve

Read pin details given its ID.

Example Usage

from glean.api_client import Glean
import os


with Glean(
    api_token=os.getenv("GLEAN_API_TOKEN"),
) as glean:

    res = glean.client.pins.retrieve()

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
locale Optional[str] ➖ The client's preferred locale in rfc5646 format (e.g. en, ja, pt-BR). If omitted, the Accept-Language will be used. If not present or not supported, defaults to the closest match or en.
id Optional[str] ➖ The opaque id of the pin to be fetched.
retries Optional[utils.RetryConfig] ➖ Configuration to override the default retry behavior of the client.

Response

models.GetPinResponse

Errors

Error Type Status Code Content Type
errors.GleanError 4XX, 5XX */*

list

Lists all pins.

Example Usage

from glean.api_client import Glean
import os


with Glean(
    api_token=os.getenv("GLEAN_API_TOKEN"),
) as glean:

    res = glean.client.pins.list(request_body={})

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
request_body models.ListpinsRequestBody ✔️ List pins request
locale Optional[str] ➖ The client's preferred locale in rfc5646 format (e.g. en, ja, pt-BR). If omitted, the Accept-Language will be used. If not present or not supported, defaults to the closest match or en.
retries Optional[utils.RetryConfig] ➖ Configuration to override the default retry behavior of the client.

Response

models.ListPinsResponse

Errors

Error Type Status Code Content Type
errors.GleanError 4XX, 5XX */*

create

Pin a document as a result for a given search query.Pin results that are known to be a good match.

Example Usage

from glean.api_client import Glean, models
import os


with Glean(
    api_token=os.getenv("GLEAN_API_TOKEN"),
) as glean:

    res = glean.client.pins.create(audience_filters=[
        {
            "field_name": "type",
            "values": [
                {
                    "value": "Spreadsheet",
                    "relation_type": models.RelationType.EQUALS,
                },
                {
                    "value": "Presentation",
                    "relation_type": models.RelationType.EQUALS,
                },
            ],
        },
    ])

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
locale Optional[str] ➖ The client's preferred locale in rfc5646 format (e.g. en, ja, pt-BR). If omitted, the Accept-Language will be used. If not present or not supported, defaults to the closest match or en.
queries List[str] ➖ The query strings for which the pinned result will show.
audience_filters List[models.FacetFilter] ➖ Filters which restrict who should see the pinned document. Values are taken from the corresponding filters in people search.
document_id Optional[str] ➖ The document to be pinned.
retries Optional[utils.RetryConfig] ➖ Configuration to override the default retry behavior of the client.

Response

models.PinDocument

Errors

Error Type Status Code Content Type
errors.GleanError 4XX, 5XX */*

remove

Unpin a previously pinned result.

Example Usage

from glean.api_client import Glean
import os


with Glean(
    api_token=os.getenv("GLEAN_API_TOKEN"),
) as glean:

    glean.client.pins.remove()

    # Use the SDK ...

Parameters

Parameter Type Required Description
locale Optional[str] ➖ The client's preferred locale in rfc5646 format (e.g. en, ja, pt-BR). If omitted, the Accept-Language will be used. If not present or not supported, defaults to the closest match or en.
id Optional[str] ➖ The opaque id of the pin to be unpinned.
retries Optional[utils.RetryConfig] ➖ Configuration to override the default retry behavior of the client.

Errors

Error Type Status Code Content Type
errors.GleanError 4XX, 5XX */*
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.