https://developer.zendesk.com/rest_api/docs/core/ticket_metrics#show-ticket-metrics
172583
def ticket_metric_show(self, ticket_metric_id, **kwargs):
        ""
        api_path = "/api/v2/ticket_metrics/{ticket_metric_id}.json"
        api_path = api_path.format(ticket_metric_id=ticket_metric_id)
        return self.call(api_path, **kwargs)
1169492
def get_ticket_for_sns_token(self):
        """"""
        self.logger.info("%s\t%s" % (self.request_method, self.request_url))
        return {
            "openid": self.get_openid(),
            "persistent_code": self.get_persistent_code(),
        }
740980
def deleted_ticket_delete(self, id, **kwargs):
        ""
        api_path = "/api/v2/deleted_tickets/{id}.json"
        api_path = api_path.format(id=id)
        return self.call(api_path, method="DELETE", **kwargs)
998506
def resource_collection_show(self, id, **kwargs):
        ""
        api_path = "/api/v2/resource_collections/{id}.json"
        api_path = api_path.format(id=id)
        return self.call(api_path, **kwargs)
848940
function MetricsServer(port) {
  this.servedMetrics = [];
  this.sorted = true;
  this.startTime = new Date();
  this.server = http.createServer(this._handleRequest.bind(this));
  this.server.listen(port);
  debug('Serving metrics on localhost:%d/eyes', port);
}
404530
def tickets_list(self, external_id=None, include=None, **kwargs):
        ""
        api_path = "/api/v2/tickets.json"
        api_query = {}
        if "query" in kwargs.keys():
            api_query.update(kwargs["query"])
            del kwargs["query"]
        if external_id:
            api_query.update({
                "external_id": external_id,
            })
        if include:
            api_query.update({
                "include": include,
            })
        return self.call(api_path, query=api_query, **kwargs)
1183216
def ticket_comments(self, ticket_id, **kwargs):
        ""
        api_path = "/api/v2/tickets/{ticket_id}/comments.json"
        api_path = api_path.format(ticket_id=ticket_id)
        return self.call(api_path, **kwargs)
1008483
def list_metrics():
    """"""
    for name, operator in ALL_OPERATORS.items():
        print(f"{name} operator:")
        if len(operator.cls.metrics) > 0:
            print(
                tabulate.tabulate(
                    headers=("Name", "Description", "Type"),
                    tabular_data=operator.cls.metrics,
                    tablefmt=DEFAULT_GRID_STYLE,
                )
            )
907205
public static Ticket ticketGetticket(String access_token,String type){
		HttpUriRequest httpUriRequest = RequestBuilder.get()
				.setUri(BASE_URI + "/cgi-bin/ticket/getticket")
				.addParameter(PARAM_ACCESS_TOKEN, API.accessToken(access_token))
				.addParameter("type", type)
				.build();
		return LocalHttpClient.executeJsonResult(httpUriRequest,Ticket.class);
	}
742983
def get_jsapi_ticket(self):
        
        ticket_key = '{}_jsapi_ticket'.format(self._client.corp_id)
        expires_at_key = '{}_jsapi_ticket_expires_at'.format(self._client.corp_id)
        ticket = self.session.get(ticket_key)
        expires_at = self.session.get(expires_at_key, 0)
        if not ticket or expires_at < int(time.time()):
            jsapi_ticket = self.get_ticket()
            ticket = jsapi_ticket['ticket']
            expires_at = int(time.time()) + int(jsapi_ticket['expires_in'])
            self.session.set(ticket_key, ticket)
            self.session.set(expires_at_key, expires_at)
        return ticket
695385
def __get_metrics(self):
        
        esfilters_close = None
        esfilters_submit = None
        if self.esfilters:
            esfilters_close = self.esfilters.copy()
            esfilters_submit = self.esfilters.copy()

        closed = ClosedPR(self.es_url, self.es_index,
                          start=self.start, end=self.end,
                          esfilters=esfilters_close, interval=self.interval)
        # For BMI we need when the ticket was closed
        closed.FIELD_DATE = 'closed_at'
        submitted = SubmittedPR(self.es_url, self.es_index,
                                start=self.start, end=self.end,
                                esfilters=esfilters_submit,
                                interval=self.interval)

        return (closed, submitted)
815560
def ticket_audits(self, ticket_id, **kwargs):
        ""
        api_path = "/api/v2/tickets/{ticket_id}/audits.json"
        api_path = api_path.format(ticket_id=ticket_id)
        return self.call(api_path, **kwargs)
227303
def recent(self, include=None):
        
        return self._query_zendesk(self.endpoint.recent, 'ticket', id=None, include=include)
614544
def dashboard(request):
    """"""
    sources = (models.Source.objects.all().prefetch_related('metric_set')
                                          .order_by('name'))
    metrics = SortedDict([(src, src.metric_set.all()) for src in sources])
    no_source_metrics = models.Metric.objects.filter(source__isnull=True)
    if no_source_metrics:
        metrics[''] = no_source_metrics

    if request.META.get('HTTP_X_PJAX', False):
        parent_template = 'pjax.html'
    else:
        parent_template = 'base.html'
    return render(request, 'metrics/dashboard.html', {
        'source_metrics': metrics,
        'parent_template': parent_template
    })
372291
def search_metrics(self, query, fromTime=None, toTime=None, requestedDataPoints=600, maxDataPoints=800):
        ''''''
        def millisectimestamp(ts):
            '''Convert UNIX timestamp to milliseconds'''
            if ts > 10**12:
                ts = ts/(10**(len(str(ts))-13))
            else:
                ts = ts*10**(12-len(str(ts)))
            return int(ts)

        params = {'query': [{"query":query, "rowId":"A"}],
                  'startTime': millisectimestamp(fromTime),
                  'endTime': millisectimestamp(toTime),
                  'requestedDataPoints': requestedDataPoints,
                  'maxDataPoints': maxDataPoints}
        r = self.post('/metrics/results', params)
        return json.loads(r.text)
667689
def tickets(self, view, include=None):
        
        return self._get(self._build_url(self.endpoint.tickets(id=view, include=include)))
948028
def ticket_field_create(self, data, **kwargs):
        ""
        api_path = "/api/v2/ticket_fields.json"
        return self.call(api_path, method="POST", data=data, **kwargs)