Update an existing user-generated pin.
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)
| 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. |
models.PinDocument
| Error Type |
Status Code |
Content Type |
| errors.GleanError |
4XX, 5XX |
*/* |
Read pin details given its ID.
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)
| 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. |
models.GetPinResponse
| Error Type |
Status Code |
Content Type |
| errors.GleanError |
4XX, 5XX |
*/* |
Lists all pins.
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)
| 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. |
models.ListPinsResponse
| Error Type |
Status Code |
Content Type |
| errors.GleanError |
4XX, 5XX |
*/* |
Pin a document as a result for a given search query.Pin results that are known to be a good match.
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)
| 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. |
models.PinDocument
| Error Type |
Status Code |
Content Type |
| errors.GleanError |
4XX, 5XX |
*/* |
Unpin a previously pinned result.
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 ...
| 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. |
| Error Type |
Status Code |
Content Type |
| errors.GleanError |
4XX, 5XX |
*/* |